compose-trans: Composable monad transformers
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 of TransM
(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 about 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 transformer.
Modules
[Index]
Downloads
- compose-trans-0.1.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
- No Candidates
Versions [RSS] | 0.0, 0.1 |
---|---|
Dependencies | base (>=2 && <5), mtl [details] |
License | BSD-3-Clause |
Author | Miguel Mitrofanov |
Maintainer | miguelimo38@yandex.ru |
Category | Monads |
Uploaded | by MiguelMitrofanov at 2011-11-05T13:10:11Z |
Distributions | |
Reverse Dependencies | 1 direct, 0 indirect [details] |
Downloads | 2047 total (4 in the last 30 days) |
Rating | (no votes yet) [estimated by Bayesian average] |
Your Rating | |
Status | Docs uploaded by user Build status unknown [no reports yet] |