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

19 lines
659 B
Agda
Raw Normal View History

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 } Kont Tv Value Tv StepResult
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 } Exp (Γ , A) B Env Γ Value A Kont B StepResult
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