mirror of
https://github.com/unisonweb/unison.git
synced 2024-11-10 20:00:27 +03:00
695 B
695 B
.> 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
.> 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
()