MonadCompose-0.7.0.0: Methods for composing monads.

Safe HaskellSafe-Inferred
LanguageHaskell98

Control.Monad.PlusMonad

Description

The Plus monad - a free combination of monads. This is very similar to coproducts, but not quite the same.

Coproducts are due to Luth and Ghani, "Composing Monads Using Coproducts," http://www.informatik.uni-bremen.de/~cxl/papers/icfp02.pdf

Synopsis

Documentation

newtype (m ::+ n) t Source

Constructors

Plus 

Fields

unPlus :: forall x. MonadPlus x => (forall u. m u -> x u) -> (forall u. n u -> x u) -> x t
 

Instances

inl :: m t -> (::+) m n t Source

inr :: n t -> (::+) m n t Source

mapPlus :: (forall t. m t -> m1 t) -> (forall t. n t -> n1 t) -> (m ::+ n) t -> (m1 ::+ n1) t Source

comm :: (m ::+ n) t -> (n ::+ m) t Source

assoc :: (::+) ((::+) m n) n1 t -> (::+) m ((::+) n n1) t Source

assoc1 :: (::+) t ((::+) n1 n) t1 -> (::+) ((::+) t n1) n t1 Source

refl :: MonadPlus t => (::+) t t t1 -> t t1 Source

distr :: (::+) (Product m1 h) (Product n1 h1) a -> Product ((::+) m1 n1) ((::+) h h1) a Source

Distributivity with monad products.