[Haskell-cafe] Re: Transformers versus monadLib versus...

Ertugrul Soeylemez es at ertes.de
Mon Jul 5 21:27:19 EDT 2010

Gregory Crosswhite <gcross at phys.washington.edu> wrote:

> What is the current state of opinion regarding transformers versus
> monadLib versus mmtl versus ... etc.?  Transformers seems to be the
> "blessed" replacement for mtl, so when is it worthwhile to use the
> other libraries instead?
> (It hadn't even occurred to me to look closely at packages other than
> transformers for this purpose until I read a message earlier today
> from someone who said that he uses monadLib whenever he needs to use
> monad transformers, and it has now made me curious about them.)

That would be me.  When I was sick of flipping runWhateverT all the
time, I had a closer look at the 'transformers' package.  But my
impression was that the only advantage is that I wouldn't need to flip

I compared it to monadLib, which does a lot more.  It saves me from
having to do multi-lifts in complicated monads and it has a generalized
MonadIO, called BaseM, which works for other lowest-level-monads, too,
like 'ST s'.  It includes a ChoiceT monad transformer, which is like
ListT, but is not broken.

Further it has very useful monadic functions.  For example there is an
'abort' function to escape from a ContT computation, so you don't need
to use that ugly callCC, if you just want early exit route.  You also
get labelled jumps for free, if you ever need them desperately.

As an interesting feature, if you have a monad, which is isomorphic to a
known monad, you can derive all the Functor/Monad instance functions
from this isomorphism.  All you need to do is to tell monadLib how one
would turn a computation of the monad in question into a computation of
the known monad.


nightmare = unsafePerformIO (getWrongWife >>= sex)

More information about the Haskell-Cafe mailing list