Skip to content

Commit

Permalink
Continuations for actor stepping.
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasabel committed Apr 3, 2018
1 parent bfc7225 commit 3cad2c2
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions src/Cont.agda
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@

module Cont where

open import ActorMonad
open import SimulationEnvironment
open import Membership using (_∈_ ; _⊆_ ; [] ; _∷_ ; Z ; S ; lookup-parallel ; lookup-parallel-≡ ; translate-∈ ; x∈[]-⊥ ; translate-⊆ ; ⊆-trans ; find-∈)

open import Data.List using (List ; _∷_ ; [] ; map ; _++_ ; drop)
open import Data.List.All using (All ; _∷_ ; []; lookup) renaming (map to ∀map)
open import Data.List.All.Properties using (++⁺ ; drop⁺)
open import Data.List.Properties using (map-++-commute)
open import Data.List.Any using (Any ; here ; there)
open import Data.Nat using (ℕ ; zero ; suc ; _≟_ ; _<_)
open import Data.Nat.Properties using (≤-reflexive)
open import Data.Product using (Σ ; _,_ ; _×_ ; Σ-syntax)
open import Data.Unit using (⊤ ; tt)
open import Data.Empty using (⊥ ; ⊥-elim)

open import Relation.Binary.PropositionalEquality using (_≡_ ; refl ; sym ; cong ; cong₂ ; trans)
open import Relation.Nullary using (Dec ; yes ; no)

open import Level using (Lift ; lift)
open import Size using (Size; ∞)

open Actor
open ValidActor
open Env
open NamedInbox


Cont : (i : Size) (IS : InboxShape) {A B : Set₁}
(pre : A TypingContext)
(post : B TypingContext)
Set₂
Cont i IS {A} {B} pre post = (x : A) ∞ActorM i IS B (pre x) post

data ContStack (i : Size) (IS : InboxShape) {A : Set₁} (pre : A TypingContext) :
{B : Set₁} (post : B TypingContext) Set₂ where
[] : ContStack i IS pre pre
_∷_ : {B C}{mid : B TypingContext} {post : C TypingContext}
Cont i IS pre mid ContStack i IS mid post ContStack i IS pre post

record ActorState (i : Size) (IS : InboxShape) (C : Set₁) (pre : TypingContext) (post : C TypingContext) : Set₂ where
field
{A} : Set₁
{mid} : A TypingContext
act : ActorM i IS A pre mid
cont : ContStack i IS mid post

0 comments on commit 3cad2c2

Please sign in to comment.