Safe Haskell | None |
---|---|
Language | Haskell2010 |
Documentation
This module provides a simple exception throwind effect
with a single operation throw
and two ready-made handlers
newtype Exception m a
The functor representing the exception. You shouldn't need
to create this manually, just use throw
.
throw :: (Member (Exception a) r, Typeable a) => a -> Eff r b
Throw an exception. The only requirement is that exception be typeable.
exceptionHandler :: Handler (Exception m) r a (Either m a)
This handler converts an program that might throw an exception into a program that returns either its result or the exception.
defValueExceptionHandler :: a -> Handler (Exception m) r a a
This function generates a handler that upon a throw
short-circuts
the computation and returns the default value instead.