


Description 
Error utilities


Synopsis 



Documentation 


:: MonadError e m   => e > Maybe b  Decider function
 > m a  Monad
 > b > m a  Handler function
 > m a  Result: A monadic operation on type a
 catchErrorJust is an error catcher for the Maybe type. As input is given
a deciding function, a monad and a handler. When an error is caught, the
decider is executed to decide if the error should be handled or not.
Then the handler is eventually called to handle the error.










:: MonadError e m   => m a  Monad to operate on
 > m (Either e a)  Returns: Explicit Either type
 tryError uses Either to explicitly define the outcome of a
monadic operation. An error is caught and placed into Right,
whereas successful operation is placed into Left.




:: MonadError e m   => e > Maybe b  Decider
 > m a  Monad
 > m (Either b a)  Returns: Explicit Either type
 tryErrorJust is the catchErrorJust version of tryError
given is a decider guarding whether or not the error should be
handled. The handler will always Right and no errors are Left'ed
through. If the decider returns Nothing, the error will be thrown
further up.




:: MonadError e m   => m a  Monadic operation
 > m b  Guard
 > m a  Returns: A new monad.
 finallyError is a monadic version of the classic UNWINDPROTECT of
lisp fame. Given parameters m and after (both monads) we proceed to
work on m. If an error is caught, we execute the outguard, after,
before rethrowing the error. If m does not fail, after is executed
and the value of m is returned.




:: MonadError e m   => m a  Before (inguard) monad
 > a > m b  After (outguard) operation. Fed output of before
 > a > m c  Monad to work on. Fed with output of before
 > m c  Resulting monad.
 bracketError is the monadic version of DYNAMICWIND from Scheme
fame. Parameters are: before, after and m. before is the inguard
being executed before m. after is the outguard and protects fails
of the m.
In the Haskell world, this scheme is called a bracket and is often
seen employed to manage resources.




:: MonadError e m   => m a  Before (inguard)
 > m b  After (outguard)
 > m c  Monad to work on
 > m c  Resulting monad
 bracketError_ is the nonbound version of bracketError. The
naming scheme follows usual Haskell convention.



Produced by Haddock version 2.4.2 