>>> :{ classify :: ReturnWith String :> es => Int -> Eff es String classify n = do when (n < 0) $ returnWith "negative" when (n == 0) $ returnWith "zero" pure "positive":}
The ReturnWith effect uses runtime exceptions underneath, so the usual
rules apply. In particular, in multi-threaded code a call to returnWith in
a child thread will not automatically propagate to the parent. If you need
that, use functions such as withAsync from the
Effectful.Concurrent.Async
module of the effectful package (which propagate exceptions from child
threads to their parents) or arrange the propagation yourself.
For more information see the documentation of the
Concurrent
effect.