freer-simple-1.2.1.2: A friendly effect system for Haskell.
Copyright (c) 2016 Allele Dev; 2017 Ixperta Solutions s.r.o.; 2017 Alexis King
License BSD3
Maintainer Alexis King <lexi.lambda@gmail.com>
Stability experimental
Portability GHC specific language extensions.
Safe Haskell None
Language Haskell2010

Control.Monad.Freer.Error

Description

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

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

Synopsis

Documentation

newtype Error e r where Source #

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

Constructors

Error :: e -> Error e r

throwError :: forall e effs a. Member ( Error e) effs => e -> Eff effs a Source #

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

runError :: forall e effs a. Eff ( Error 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 :: forall e effs a. Member ( Error e) effs => Eff effs a -> (e -> Eff effs a) -> Eff effs a Source #

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

handleError :: forall e effs a. Eff ( Error e ': effs) a -> (e -> Eff effs a) -> Eff effs a Source #

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