unison/unison-src/transcripts-using-base/fix2297.output.md
2024-01-25 11:50:27 -05:00

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
```