[Haskell-cafe] Removing mtl from the Haskell Platform

roconnor at theorem.ca roconnor at theorem.ca
Tue May 12 19:03:03 EDT 2009


I wanted to pass this idea around the cafe to get some thoughts before 
submitting a trac on this topic.

I'd like to see the mtl removed from the Haskell Platform.

The mtl was a tremendous step forward when it was developed.  However, we 
have learned a few things about monad transformers since the development 
of the mtl, and it is time that we moved forward.

There are at least 3 significant problem with the mtl.

1) `pass' should not be a member functions of the MonadWriter class.  It 
is my understanding that there is no `MonadWriter w m => MonadWriter w 
(ContT s m)' instance because the `pass' function cannot be implemented. 
I'm also highly suspicious of some other methods too (I'm looking at you 
`local').

2) The `StateT s (Cont r a)' instance of callCC is wrong.  The paper on 
modular monad transformers 
<http://www.cs.nott.ac.uk/~mjj/pubs/mmt/mmt.pdf> describes why this is 
wrong.

3) I am told by many people that the order of the state and value pair in 
`State' is backwards.  Actually, I'm not entirely sure what the issue is 
here, but I trust the people who say this.

I think that use of the mtl should be deprecated so that we move on to 
improved monad transformer libraries.  Having the mtl in the Haskell 
Platform does the opposite by further entrenching its use, possibly to the 
point where we may not be able to get rid of it for years.

If I had to recommend a replace library, I would pick monadLib.  However, 
there are other libraries, such as the mmtl and transformers and it's 
related packages that I haven't looked at, and may also make fine 
replacements for the mtl.

-- 
Russell O'Connor                                      <http://r6.ca/>
``All talk about `theft,''' the general counsel of the American Graphophone
Company wrote, ``is the merest claptrap, for there exists no property in
ideas musical, literary or artistic, except as defined by statute.''


More information about the Haskell-Cafe mailing list