unison/unison-src/tests/io-state2.u
2018-09-24 13:36:13 -04:00

23 lines
393 B
Plaintext

--IO/State2 effect
effect IO where
launch-missiles : {IO} ()
foo : () -> {IO} ()
foo unit =
inc-by : Int -> {IO, State Int} ()
inc-by i =
IO.launch-missiles -- OK, since declared by `inc-by` signature
y = State.get
State.put (y Int.+ i)
()
type Optional a =
Some a | None
effect State se2 where
put : ∀ se . se -> {State se} ()
get : ∀ se . {State se} se
()