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

Ivan Lazar Miljenovic ivan.miljenovic at gmail.com
Thu Jul 8 09:16:25 EDT 2010

Ertugrul Soeylemez <es at ertes.de> writes:

> Ivan Miljenovic <ivan.miljenovic at gmail.com> wrote:
>> 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.

You shouldn't, but if someone comes along and has never used one of
these before, which are they most likely to use?  The one that seems to
be most popular and is "recommended" in that it's in the platform or one
of the other ones with less publicity but is meant to be technically

>> 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.

I write stuff dealing with graphs; not much monadic stuff happening
there ;-)

>> > 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.

You can use newtypes instead of aliases with transformers as well (well,
actually you'd need monads-{tf,fd} to get the class, but still...).  My
point is, is that with a type alias it's a lot easier to "get up and go"
and start hacking without having to explicitly do "StateT s Identity a"
all the time and instead just use "State s a".

Whilst technical superiority is good, a low barrier to entry (including
good documentation) is just as good, and at times better.

Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com

More information about the Haskell-Cafe mailing list