compose-trans
Version 0.0 revision 0 uploaded by MiguelMitrofanov.
Package meta
- Synopsis
- Composable monad transformers
- Description
A version of monad transformers that (a) allows one to convince the type checker that transformer application is a monad, and (b) doesn't need lots of boilerplate to add a new transformer. It's supposed to play nicely with
Control.Monad.Trans
.In order to make a new transformer (say,
T
) an instance ofTransM
(TransP
,TransF
) class, all you have to do is:define
instance MonadTrans T
— which you've probably done alreadydefine
instance Monad m => Monad (T m)
— also something quite common (forTransP
andTransF
you'd need another instance forMonadPlus
andMonadFix
, respectively).write
instance Trans T where transMInst = instM
— which is exactly one line of boilerplate. Sorry for that.
After that, you can use your new and shiny transformer in compositions, like
ReaderT Char :. T :. WriterT String
— and such a composition would automagically become a monad transmormer.- Author
- Miguel Mitrofanov
- Bug reports
- n/a
- Category
- Monads
- Copyright
- n/a
- Homepage
- n/a
- Maintainer
- miguelimo38@yandex.ru
- Package URL
- n/a
- Stability
- n/a