freer-effects-0.3.0.0: Implementation of effect system for Haskell.

Copyright(c) 2016 Allele Dev; 2017 Ixperta Solutions s.r.o.
LicenseBSD3
Maintainerixcom-core@ixperta.com
Stabilityexperimental
PortabilityGHC specific language extensions.
Safe HaskellNone
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 a Source #

Exceptions of the type e :: * with no resumption.

Constructors

Exc e 

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

Throws an error carrying information of type e :: *.

runError :: Eff (Exc e ': effs) a -> Eff effs (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, while interrupting the execution of any other effect handlers.

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

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