compose-trans-0.1: Composable monad transformers



MonadPlus transformers. There are also Monad and MonadFix transformes, see the corresponding modules.

Note that each MonadPlus transformer is also a Monad transformer.



data MonadP m x Source

MonadP m is actually a free MonadPlus generated by m. MonadP is a monad itself (on the (* -> *) category), as usually happens with free structures.

class TransM t => TransP t whereSource

A composable MonadPlus transformer.


transPInst :: MonadPlus m => Inst MonadP (t m)Source

You shoudn't (and probably can't) use *anything* except for instP, defined in this very module, as transPInst.

If you define instance TransP T where transPInst = instP, then you would also need to define instance MonadPlus m => MonadPlus (T m) somewhere in your code.


TransP ListT 
TransP (ReaderT r) 
TransP (StateT s) 
Monoid w => TransP (WriterT w) 
(TransP t1, TransP t2) => TransP (:. t2 t1) 

instP :: MonadPlus m => Inst MonadP mSource

A MonadPlus is nothing but an algebra over the MonadP monad. instP provides it's structure map.

mzero' :: Inst MonadP m -> m xSource

Sometimes we need an instance MonadPlus T, while everything we've got is InstP MonadP T. In this case, mzero' serves as a mzero substitution.

mplus' :: Inst MonadP m -> m x -> m x -> m xSource

Sometimes we need an instance Monad T, while everything we've got is Inst MonadP T. In this case, mplus' serves as a mplus substitution.