failure-0.0.0.2: A simple type class for success/failure computations.

Control.Failure

Contents

Description

Type classes for returning failures.

Synopsis

Type classes

class Failure e f whereSource

Methods

failure :: e -> f vSource

Instances

Exception e => Failure e IO 
Failure e [] 
Failure e Maybe 
Failure e DummyMonad 
Failure e (Either e) 

class (Functor f, Failure e f) => FunctorFailure e f Source

Instances

FunctorFailure e DummyMonad 
(Functor f, Failure e f) => FunctorFailure e f 

class (Applicative f, Failure e f) => ApplicativeFailure e f Source

Instances

class (Monad f, Applicative f, Failure e f) => MonadFailure e f Source

Instances

MonadFailure e DummyMonad 
(Monad f, Applicative f, Failure e f) => MonadFailure e f 

Wrapping failures

class Failure e f => WrapFailure e f whereSource

Methods

wrapFailure :: (forall eIn. Exception eIn => eIn -> e) -> f a -> f aSource

Wrap the failure value, if any, with the given function. This is useful in particular when you want all the exceptions returned from a certain library to be of a certain type, even if they were generated by a different library.

Instances

Convenience String failure

Convert Failures into concrete types

class Try f whereSource

Associated Types

type Error f Source

Methods

try :: ApplicativeFailure (Error f) f' => f a -> f' aSource

Instances

Try [] 
Try Maybe 
Try (Either e)