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

Ertugrul Soeylemez es at ertes.de
Thu Jul 8 09:09:03 EDT 2010

Ivan Miljenovic <ivan.miljenovic at gmail.com> wrote:

> On 8 July 2010 13:48, Ertugrul Soeylemez <es at ertes.de> wrote:
> > Ivan Miljenovic <ivan.miljenovic at gmail.com> wrote:
> >
> >> mtl's advantages: wide pre-existing user base, etc.
> >
> > As said, I don't think this is a valid argument.  Windows has a much
> > larger user base than Linux.  C++ has a much larger user base than
> > Haskell.  We still use Haskell, and many of us use Linux.
> My point was, was that if you need to pick a monad transformer library
> and you've never done any before, then some people are likely to
> choose mtl because it's currently the most-used library, it comes with
> the platform and if they need to interact with another package that
> uses a monad transformer library then it's more likely to be using mtl
> than anything else.

Yes, that's true.  And my point is that that doesn't mean you shouldn't
use anything else.

> >> transformers (especially when used with monads-{fd,tf}) advantage
> >> over monadLib: pre-existing type aliases, documentation, easier to
> >> port old code that was using mtl.
> >
> > If you don't use monadLib-specific features, then most code will run
> > in monadLib as well as transformers without changes.  The Haddock
> > documentation of monadLib is quite brief, but if you know how to use
> > monad transformers, you won't have any problems.
> I for one don't know how to use monad transformers (I mean, I've read
> the section in RWH and could figure it out, but off the top of my head
> I can't recall how to do all the lifting stuff, etc.).

They are easy to use and very useful, especially to make code more
modular.  You should try them out.

> > And I don't know what you mean by "pre-existing type aliases".
> http://hackage.haskell.org/packages/archive/transformers/

MonadLib has newtypes instead of type aliases for them.  But the
implementations are the same (M = MT Id).  Interestingly I need
transformers much more often than ready-made monads.


nightmare = unsafePerformIO (getWrongWife >>= sex)

More information about the Haskell-Cafe mailing list