compose-trans-0.1: Composable monad transformers



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

Note that each MonadFix transformer is also a Monad transformer.



data MonadF m x Source

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

class TransM t => TransF t whereSource

A composable MonadFix transformer.


transFInst :: MonadFix m => Inst MonadF (t m)Source

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

If you define instance TransF T where transFInst = instF, then you would also need to define instance MonadFix m => MonadFix (T m) somewhere in your code.


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

instF :: MonadFix m => Inst MonadF mSource

A MonadFix is nothing but an algebra over the MonadF monad. instF provides it's structure map.

mfix' :: Inst MonadF m -> (x -> m x) -> m xSource

Sometimes we need an instance MonadFix T, while everything we've got is InstP MonadF T. In this case, mfix' serves as a mfix substitution.