freer-0.2.2.2: Implementation of the Freer Monad

CopyrightAlej Cabrera 2015
LicenseBSD-3
Maintainercpp.cabrera@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellSafe
LanguageHaskell2010

Control.Monad.Freer.Exception

Description

Composable handler for Exception effects. Communicates success/failure via an Either type.

Using http://okmij.org/ftp/Haskell/extensible/Eff1.hs as a starting point.

Synopsis

Documentation

newtype Exc e v Source

Exceptions of the type e; no resumption

Constructors

Exc e 

throwError :: Member (Exc e) r => e -> Eff r a Source

Throws an error carrying information of type e

runError :: Eff (Exc e : r) a -> Eff r (Either e a) Source

Handler for exception effects If there are no exceptions thrown, returns Right If exceptions are thrown and not handled, returns Left, interrupting the execution of any other effect handlers.

catchError :: Member (Exc e) r => Eff r a -> (e -> Eff r a) -> Eff r a Source

A catcher for Exceptions. Handlers are allowed to rethrow exceptions.