mtl, transformers, monads-fd, monadLib, and the paradox of choice

Posted by yairchu on Stack Overflow See other posts from Stack Overflow or by yairchu
Published on 2010-05-04T22:51:29Z Indexed on 2010/05/04 22:58 UTC
Read the original article Hit count: 418

Hackage has several packages for monad transformers:

  • mtl: Monad transformer library
  • transformers: Concrete functor and monad transformers
  • monads-fd: Monad classes, using functional dependencies
  • monads-tf: Monad classes, using type families
  • monadLib: A collection of monad transformers.
  • mtl-tf: Monad transformer library using type families
  • mmtl: Modular Monad transformer library
  • mtlx: Monad transformer library with type indexes, providing 'free' copies.
  • compose-trans: Composable monad transformers

(and maybe I missed some)

Which one shall we use?

mtl is the one in the Haskell Platform, but I keep hearing on reddit that it's uncool.

But what's bad about choice anyway, isn't it just a good thing?

Well, I saw how for example the authors of data-accessor had to make all these to cater to just the popular choices:

  • data-accessor-monadLib library: Accessor functions for monadLib's monads
  • data-accessor-monads-fd library: Use Accessor to access state in monads-fd State monad class
  • data-accessor-monads-tf library: Use Accessor to access state in monads-tf State monad type family
  • data-accessor-mtl library: Use Accessor to access state in mtl State monad class
  • data-accessor-transformers library: Use Accessor to access state in transformers State monad

I imagine that if this goes on and for example several competing Arrow packages evolve, we might see something like: spoonklink-arrows-transformers, spoonklink-arrows-monadLib, spoonklink-tfArrows-transformers, spoonklink-tfArrows-monadLib, ...

And then I worry that if spoonklink gets forked, Hackage will run out of disk space. :)

Questions:

  • Why are there so many monad transformer packages?
  • Why is mtl [considered] uncool?
  • What are the key differences?
  • Most of these seemingly competing packages were written by Andy Gill and are maintained by Ross Paterson. Does this mean that these packages are not competing but rather work together in some way? And do Andy and Ross consider any of their own packages as obsolete?
  • Which one should me and you use?

© Stack Overflow or respective owner

Related posts about haskell

Related posts about monad-transformers