unison/unison-src/transcripts-using-base/fix2297.md
Arya Irani 951b6ae76b fix fix2297
this had broken in the past when we made discarding non-Unit values explicit
and nobody noticed until now
2024-01-05 15:08:52 -10:00

620 B

This tests a case where a function was somehow discarding abilities.

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