mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-11 02:25:39 +03:00
717 B
717 B
scratch/main> builtins.merge
This transcript demonstrates that Unison forces actions in blocks to have a return type of ()
.
This works, as expected:
structural ability Stream a where emit : a -> ()
ex1 = do
Stream.emit 1
Stream.emit 2
42
scratch/main> add
This does not typecheck, we've accidentally underapplied Stream.emit
:
ex2 = do
Stream.emit
42
We can explicitly ignore an unused result like so:
ex3 = do
_ = Stream.emit
()
Using a helper function like void
also works fine:
void x = ()
ex4 =
void [1,2,3]
()
One more example:
ex4 =
[1,2,3] -- no good
()