[Haskell-cafe] upgrading mtl1 to mtl2

Brandon S Allbery KF8NH allbery.b at gmail.com
Fri Feb 18 00:55:15 CET 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2/16/11 00:51 , Evan Laforge wrote:
> 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...

Yes; as I understand it, mtl2 is transformers + monad-fd, and the standard
upgrade path is to go to mtl2.  monads-tf is expected to eventually replace
monads-fd, but it's not a near future change (for one thing, type families
are still being figured out; see the recent thread about injective type
functions as an example).  It was decided that the mtl2 route would be
easier than forcing people to replace mtl with transofrmers + monads-fd.

- -- 
brandon s. allbery     [linux,solaris,freebsd,perl]    allbery.b at gmail.com
system administrator  [openafs,heimdal,too many hats]                kf8nh
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk1dtWMACgkQIn7hlCsL25WPFwCaA8MbZYbZr/gQ9pa/ttj/E5a0
pTgAoIZ9LMNuq4o7arXmTUZa5qTUFjx4
=NLta
-----END PGP SIGNATURE-----



More information about the Haskell-Cafe mailing list