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

Safe HaskellSafe-Infered

Control.Failure

Contents

Description

Type classes for returning failures.

Note: This module used to contain a lot more functionality, but I believe it was unused functionality. If you want any of it back, just email me.

Synopsis

Type class

class Monad f => Failure e f whereSource

Methods

failure :: e -> f vSource

Instances

Exception e => Failure e IO 
Failure e [] 
Failure e Maybe 
(MonadTrans t, Failure e m, Monad (t m)) => Failure e (t m)

Instance for all monad transformers, simply lift the failure into the base monad.

Failure e (Either e) 

General exceptions

exception :: (Exception e, Failure SomeException m) => e -> m aSource

Convert to a SomeException via toException before calling failure.