-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Methods for composing monads. -- @package MonadCompose @version 0.7.0.0 -- | 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 module Control.Monad.PlusMonad newtype (::+) m n t Plus :: (forall x. MonadPlus x => (forall u. m u -> x u) -> (forall u. n u -> x u) -> x t) -> (::+) m n t unPlus :: (::+) m n t -> forall x. MonadPlus x => (forall u. m u -> x u) -> (forall u. n u -> x u) -> x t inl :: m t -> (::+) m n t inr :: n t -> (::+) m n t mapPlus :: (forall t. m t -> m1 t) -> (forall t. n t -> n1 t) -> (m ::+ n) t -> (m1 ::+ n1) t comm :: (m ::+ n) t -> (n ::+ m) t assoc :: (::+) ((::+) m n) n1 t -> (::+) m ((::+) n n1) t assoc1 :: (::+) t ((::+) n1 n) t1 -> (::+) ((::+) t n1) n t1 cancelLeft :: MonadPlus t => (::+) Identity t t1 -> t t1 cancelRight :: MonadPlus t => (::+) t Identity t1 -> t t1 refl :: MonadPlus t => (::+) t t t1 -> t t1 -- | Distributivity with monad products. distr :: (::+) (Product m1 h) (Product n1 h1) a -> Product ((::+) m1 n1) ((::+) h h1) a instance MonadPlus m => MMonad ((::+) m) instance MFunctor ((::+) m) instance MonadTrans ((::+) m) instance Alternative (m ::+ n) instance MonadPlus (m ::+ n) instance Applicative (m ::+ n) instance Functor (m ::+ n) instance Monad (m ::+ n) module Control.Monad.Lifter -- | An automatic lifter. The idea of automatic lifting is due to Dan -- Piponi. class Lifter m n lf :: Lifter m n => m t -> n t instance [overlap ok] (Monad x, MFunctor m) => Lifter (m Identity) (m x) instance [overlap ok] (MonadTrans n, Monad x, Lifter m x) => Lifter m (n x) instance [overlap ok] Lifter m (m ::+ n) instance [overlap ok] Lifter Identity Identity instance [overlap ok] Lifter (ST s) (ST s) instance [overlap ok] Lifter IO IO instance [overlap ok] Lifter (ST RealWorld) IO module Control.Monad.Distributive swap :: (t1, t) -> (t, t1) class MonadTrans m => Takeout m y | m -> y takeout :: (Takeout m y, Monad n) => m n t -> m Identity (n (y t)) combine :: (Takeout m y, Monad x) => m x (y t) -> m x t -- | The opposite of takeout. putin :: (MonadTrans t1, MonadTrans t, MFunctor t1, MFunctor t, Monad (t1 n), Monad (t (t1 n)), Monad (t n), Monad n) => t n (t1 Identity b) -> t (t1 n) b putin1 :: (MonadTrans t, MFunctor t, Monad (t n), Monad n) => t Identity (n b) -> t n b -- | Transformers that distribute over one another. -- -- For reorganizing a monad stack. class Leftdistr m ldist :: (Leftdistr m, Monad (n x), Monad x) => m (n x) t -> n x (m Identity t) class Rightdistr m rdist :: (Rightdistr m, Monad (n Identity), Monad (n x), MonadTrans n, MFunctor n, Monad x) => n Identity (m x t) -> m (n x) (n x t) -- | Left distributivity of a monad transformer. ldist' :: (Leftdistr t1, MonadTrans t1, MonadTrans t, MFunctor t1, MFunctor t, Monad (t1 n), Monad (t (t1 n)), Monad (t n), Monad n) => t1 (t n) b -> t (t1 n) b -- | Right distributivity. rdist' :: (Takeout m y, Rightdistr m1, MonadTrans m1, MFunctor m, Monad (m1 (m x)), Monad (m1 x), Monad (m Identity), Monad (m x), Monad x) => m (m1 x) b -> m1 (m x) b instance Rightdistr (ReaderT v) instance Rightdistr (StateT v) instance Rightdistr (StateT v) instance Leftdistr ListT instance Monoid x => Leftdistr (WriterT x) instance Error t => Leftdistr (ErrorT t) instance Leftdistr MaybeT instance Monoid w => Takeout (WriterT w) ((,) w) instance Takeout (ReaderT r) Identity instance Takeout (StateT s) ((,) s) instance Takeout (StateT s) ((,) s) module Control.Monad.IOT data IOT m t -- | Run an IOT. run :: IOT Identity t -> IO t instance MFunctor IOT instance MMonad IOT instance MonadTrans IOT instance Monad m => MonadIO (IOT m) instance Monad m => Functor (IOT m) instance Monad m => Applicative (IOT m) instance Monad m => Monad (IOT m)