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

18 lines
297 B
Plaintext

--State2 ability
structural ability State s where
put : s -> {State s} ()
state : s -> Request (State s) a -> a
state s = cases
{ State.put snew -> k } -> handle k () with state snew
{ a } -> a
ex : Text
ex = handle
State.put (11 + 1)
State.put (5 + 5)
"hello"
with state 10
> ex