cek-call-cc/src/Project/Do.agda

28 lines
983 B
Agda
Raw Normal View History

2021-12-09 02:57:30 +00:00
-- {-# OPTIONS --allow-unsolved-metas #-}
2021-12-08 18:35:31 +00:00
2021-12-08 06:33:28 +00:00
module Project.Do where
2021-12-09 08:05:20 +00:00
open import Project.Definitions
open import Project.Util
2021-12-08 06:33:28 +00:00
data StepResult (A : Type) : Set where
part : State A StepResult A
done : Value A StepResult A
2021-12-09 08:05:20 +00:00
apply-kont : {Tv } Kont Tv Value Tv StepResult
apply-kont {Tv} (kont (letk {Tc} Γ C E K)) v =
2021-12-09 02:57:30 +00:00
part $ mkState Tc (Γ , Tv) C (E [ Tv v ]) K
2021-12-09 08:05:20 +00:00
apply-kont halt v = done v
2021-12-09 02:57:30 +00:00
2021-12-09 08:05:20 +00:00
apply-proc-clo : {Γ A B } Exp (Γ , A) B Env Γ Value A Kont B StepResult
apply-proc-clo {Γ} {A} {B} body env arg k =
2021-12-08 06:33:28 +00:00
let Γ′ = Γ , A in
2021-12-09 08:05:20 +00:00
let E = env [ A arg ] in
part $ mkState B Γ′ body E k
-- apply-proc : ∀ {A B Tω} → Value (A ⇒ B) → Value A → Kont Tω B → StepResult Tω
-- apply-proc {A} {B} (clo {Γ} x E) arg K =
-- let Γ′ = Γ , A in
-- let E = E [ A arg ] in
-- part $ mkState B Γ′ x E K
-- apply-proc (cont k) arg K = apply-kont {! !} {! !}