unison/unison-src/errors/handler-coverage-checking.uu
2021-08-24 11:33:27 -07:00

30 lines
597 B
Plaintext

--State3 ability
structural ability State se2 where
put : ∀ se . se -> {State se} ()
get : ∀ se . () -> {State se} se
state : ∀ s a . s -> Request (State s) a -> (s, a)
state woot = cases
{ State.get () -> k } -> handle k woot with state woot
{ State.put snew -> k } -> handle k () with state snew
ex1 : (Nat, Nat)
ex1 = handle State.get () with state 42
ex1a : (Nat, Nat)
ex1a = handle 49 with state 42
ex1b = handle 0 with x -> 10
ex1c : Nat
ex1c = handle 0 with x -> 10
ex1d = handle 49 with state 42
ex2 = handle State.get () with state 42
ex3 : (Nat, Nat)
ex3 = ex2
()