mirror of
https://github.com/unisonweb/unison.git
synced 2024-10-26 11:07:48 +03:00
24 lines
434 B
Plaintext
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
|
|
|
|
|
|
|