Monad Transformer Library
(Use name of page, not "this page", for a link)
|(2 intermediate revisions by one user not shown)|
Latest revision as of 17:04, 21 December 2012
See the package on Hackage.
 1 History
Once upon a time, mtl was a standalone monad transformer library, that defined monad transformers and constructor classes for them. The constructor classes were frequently multiparameter classes with functional dependencies.
Some time later, type families were invented, and were found to solve several of the same problems as multiparameter classes with functional dependencies. A package named mtl-tf was developed, to provide the functionality of mtl but using type families instead.
However, there was a lot of duplicated code involved: mtl and mtl-tf both defined their own monad transformers, so they didn't work well together. The constructor classes were different by necessity, because they used different technology, but the data types themselves were duplicated for no reason.
Hence, transformers was developed: a library that used no extensions to Haskell98 and only defined the transformer types themselves, so that more advanced libraries could share them as a base. monads-fd and monads-tf were developed as libraries that took transformers from the transformers package and defined the constructor classes over the top of them, monads-fd using multiparameter typeclasses with functional dependencies and monads-tf using type families.
The technological problem was then solved, but unfortunately the original mtl library already had a lot of traction: it had existed for longer and was in widespread use. So instead of encouraging people to switch libraries, the maintainers switched implementations instead: they decided to merge monads-fd and mtl into a single library.
Since the mtl name was far better known, monads-fd was deprecated, and mtl was switched to depend on transformers. Since transformers had some stylistic differences as well, this resulted in some API changes (see above).
As it now stands, transformers is the "standard" monad transformer library, but mtl and monads-tf both act as extensions of it. monads-tf is not very well-used, which is unfortunate as it's quite a nice approach.