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
|
2021-12-09 12:00:09 +00:00
|
|
|
|
done : Value A A → StepResult A
|
2021-12-08 06:33:28 +00:00
|
|
|
|
|
2021-12-09 12:00:09 +00:00
|
|
|
|
apply-kont : ∀ {Tv Tω} → Kont Tω Tv → Value Tω Tv → StepResult Tω
|
2021-12-09 08:05:20 +00:00
|
|
|
|
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 12:00:09 +00:00
|
|
|
|
apply-proc-clo : ∀ {Γ A B Tω} → Exp Tω (Γ , A) B → Env Tω Γ → Value Tω A → Kont Tω B → StepResult Tω
|
2021-12-09 08:05:20 +00:00
|
|
|
|
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
|
2021-12-09 12:02:52 +00:00
|
|
|
|
part $ mkState B Γ′ body E′ k
|