[Haskell-cafe] ListT considered harmful

Chris Wong lambda.fairy at gmail.com
Fri Mar 27 05:36:35 UTC 2015


On Fri, Mar 27, 2015 at 5:07 PM, Michael Snoyman <michael at snoyman.com> wrote:
> I'm in favor of deprecation, but opposed to removing any time soon due to
> backwards compatibility concerns.

I agree. Given that we just deprecated ErrorT (which is both more
popular, and does follow the monad laws) I think there is good reason
to phase out transformers' ListT as well.

I've attached a patch that adds the relevant pragma. I'm not familiar
with darcs so excuse me if it's messed up :)

libraries list and/or Ross Paterson, do you have anything to say about
this issue?

> On Fri, Mar 27, 2015 at 7:03 AM Fumiaki Kinoshita <fumiexcel at gmail.com>
> wrote:
>>
>> It is well known that ListT m in transformers is not a monad unless the
>> underlying monad is commutative. The fact that ListT is not a monad
>> transformer is sufficient to remove it from the package, and several
>> packages already defined their own ListT.
>>
>> Oughtn't we deprecate ListT or replace it by a correct one?
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>



-- 
Chris Wong
https://lambda.xyz
-------------- next part --------------

New patches:

[Deprecate Control.Monad.Trans.List
Chris Wong <lambda.fairy at gmail.com>**20150327045544
 Ignore-this: 803a54f83f75fb1282172857c0451223
 
 The ListT in this module is not a monad in the general case, requiring a
 tricky invariant (commutativity in the base monad) to use properly.
 
 There are plenty of packages which provide a "ListT done right", and we
 should encourage new users to depend on those instead.
] hunk ./Control/Monad/Trans/List.hs 20
 -- which must be commutative.
 -----------------------------------------------------------------------------
 
-module Control.Monad.Trans.List (
+module Control.Monad.Trans.List
+  {-# DEPRECATED "Use the 'list-t' or 'pipes' packages instead" #-}
+  (
     -- * The ListT monad transformer
     ListT(..),
     mapListT,

Context:

[move eq1, etc out of the classes
Ross Paterson <ross at soi.city.ac.uk>**20150325235706
 Ignore-this: 23902fc2118e73528ef7d9b33dcd2410
] 
[fix warnings
Ross Paterson <ross at soi.city.ac.uk>**20150325235322
 Ignore-this: 5228163ad420d6b7befab60e7d572714
] 
[instances of Eq2, Ord2, Read2 and Show2
Ross Paterson <ross at soi.city.ac.uk>**20150325214456
 Ignore-this: 394da2a95af800f78a602423da316e3d
] 
[switch liftings of Prelude classes to use explicit dictionaries
Ross Paterson <ross at soi.city.ac.uk>**20150325192309
 Ignore-this: 8678c8c82d9d9ca34004a022d1d90f78
] 
[fix foldr1/foldl1 for Backwards (spotted by Ryan Scott)
Ross Paterson <ross at soi.city.ac.uk>**20150324144124
 Ignore-this: ac68e0a000afa5e9e48c405c0303f889
] 
[TAG 0.4.3.0
Ross Paterson <ross at soi.city.ac.uk>**20150308183108
 Ignore-this: 1dec0ecddd2fdbfed11232edc4dd362e
] 
Patch bundle hash:
9c2ea89fbf6f1638d63ea4df165f40359c7cb94b


More information about the Libraries mailing list