unison/unison-src/tests/state1.u
2021-08-24 11:33:27 -07:00

16 lines
409 B
Plaintext

--State1 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.put snew -> k } -> handle k () with state snew
{ State.get () -> k } -> handle k woot with state woot
{ a } -> (woot, a)
blah : ∀ s a . s -> Request (State s) a -> (s, a)
blah = state
> ()