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

24 lines
434 B
Plaintext

--IO/State2 ability
structural ability IO where
launchMissiles : {IO} ()
foo : Int -> {IO} Int
foo unit =
incBy : Int -> {IO, State Int} Int
incBy i =
IO.launchMissiles -- OK, since declared by `incBy` signature
y = State.get
State.put (y Int.+ i)
+42
+43
structural type Optional a =
Some a | None
structural ability State se2 where
put : ∀ se . se -> {State se} ()
get : ∀ se . {State se} se