mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-19 06:17:33 +03:00
38 lines
881 B
Markdown
38 lines
881 B
Markdown
This tests a case where a function was somehow discarding abilities.
|
|
|
|
|
|
```unison
|
|
structural ability Trivial where
|
|
trivial : ()
|
|
|
|
-- This handler SHOULD leave any additional effects alone and unhandled
|
|
handleTrivial : '{e, Trivial} a -> {e} a
|
|
handleTrivial action =
|
|
h : Request {Trivial} a -> a
|
|
h = cases
|
|
{trivial -> resume} -> handle !resume with h
|
|
{a} -> a
|
|
handle !action with h
|
|
|
|
testAction : '{Exception, IO, Trivial} ()
|
|
testAction = do
|
|
printLine "hi!"
|
|
trivial
|
|
|
|
wat : ()
|
|
wat = handleTrivial testAction -- Somehow this completely forgets about Exception and IO
|
|
|
|
> handleTrivial testAction
|
|
```
|
|
|
|
```ucm
|
|
|
|
Loading changes detected in scratch.u.
|
|
|
|
The expression in red needs the {IO} ability, but this location does not have access to any abilities.
|
|
|
|
19 | wat = handleTrivial testAction -- Somehow this completely forgets about Exception and IO
|
|
|
|
|
|
```
|