[Haskell-cafe] upgrading mtl1 to mtl2

Evan Laforge qdunkan at gmail.com
Wed Feb 16 06:51:29 CET 2011


On Tue, Feb 15, 2011 at 7:58 PM, Ivan Lazar Miljenovic
<ivan.miljenovic at gmail.com> wrote:
> On 16 February 2011 14:46, Evan Laforge <qdunkan at gmail.com> wrote:
>> I just got started on this because packages are starting to use mtl2.
>> I had hoped it would be simple, and hopefully it is, but...
>>
>> Do I really have to add (Functor m) to the 300 or so functions with
>> (Monad m) on them?  Or just not use fmap or applicative?
>
> Use liftM instead of fmap if all of your functions are polymorphic in
> the type of Monad and you don't want to bother putting in the Functor
> constraint.

There are hundreds of 'fmap's in there too.  And even more <$>s and a
scattering of <*>s.  And... these functions are convenient!  I like
using them.  If "upgrading" to mtl2 means porting away from Functor
and Applicative... then that's even less of a "minor incompatibility"!
 At least the class context mangling can be mostly done with search
and replace.

>> Says that the only benefit of 'transformers' is that it's "haskell 98
>> and thus more portable," but doesn't that come with the caveat that
>> "only if you don't use classes and do all the lifting manually"?
>
> Yes, but some people don't want the extensions.

Ok, so does that mean the migration to transformers so mtl could be
deleted is cancelled?  Or was rendered obsolete by mtl-2?  Or maybe I
was imagining it?  I think minimal extensions is a worthy goal, but
you can hardly position Y as "the next step" for X when all it is is X
minus features that people still like...



More information about the Haskell-Cafe mailing list