| 23 | | * [http://hackage.haskell.org/package/transformers transformers] is a Haskell 98 package containing the identity monad (Control.Monad.Identity), transformer classes (Control.Monad.Trans) and concrete monad transformers with code to lift operators (Control.Monad.Trans.*). There are also a number of changes in comparison with mtl: |
| 24 | | * simple monads like {{{State s}}} are now aliases for {{{StateT s Identity}}}. |
| 25 | | * Functor instances for monad transformers no longer require Monad where Functor is sufficient. |
| 26 | | * instances of {{{Applicative}}} and {{{Alternative}}} have been added as appropriate. |
| 27 | | The package can be used on its own (see the [http://hackage.haskell.org/packages/archive/transformers/0.1.4.0/doc/html/Control-Monad-Trans.html Control.Monad.Trans documentation] for examples), or with packages adding type classes. |
| | 20 | * [http://hackage.haskell.org/package/transformers transformers] is a Haskell 98 package containing the identity monad (Data.Functor.Identity), transformer classes (Control.Monad.Trans.Class and Control.Monad.IO.Class) and concrete monad transformers with code to lift operators (Control.Monad.Trans.*). |
| | 21 | The package can be used on its own (see the [http://hackage.haskell.org/packages/archive/transformers/latest/doc/html/Control-Monad-Trans-Class.html Control.Monad.Trans.Class documentation] for examples), or with packages adding type classes. |
| 43 | | * Both transformers and the new mtl would expose the modules {{{Control.Identity}}} and {{{Control.Monad.Trans}}}, though the mtl versions would be re-exports of the transformers modules. Thus people using {{{ghc --make}}} would still see conflicts. |
| | 40 | Some other issues have been raised with mtl over the years, but they are orthogonal to this proposal: |
| | 41 | * The MonadCont instance for StateT is not compatible with the monad transformer. The transformers package provides the correct lifting (in which callcc causes the state to rollback on entering the saved continuation), but also provides the MTL lifting for compatibility, and this is used by monads-fd. It could be switched to the correct lifting later. |
| | 42 | * The ErrorT monad transformer has an Error constraint, so that errors can be passed to the fail method of the Monad class. |
| | 43 | * ListT only works on commutative monads. |
| 47 | | A [http://www.haskell.org/pipermail/libraries/2009-March/011471.html survey] of Hackage in March 2009 found 19 packages that would fail to compile with the proposed new version of mtl. Note that this survey excluded packages that depend (directly or indirectly) on gtk2hs or any other packages not available on hackage. It also excluded packages that already declare an appropriate upper bound on their mtl dependency. |
| 48 | | |
| 49 | | Those packages will need changes to compile with the new version of mtl, but need not switch to transformers and monads-fd (or just transformers) until later. These packages could add a dependency constraint {{{mtl < 2}}} now, to avoid being built with the new version when it appears. The affected packages are listed below. |
| 50 | | |
| 51 | | Different dependencies, extra instances: |
| 52 | | |
| 53 | | * [http://hackage.haskell.org/package/blogination blogination]: Functor instances depending on Functor, instance collision Applicative/Alternative ErrorT |
| 54 | | * [http://hackage.haskell.org/package/category-extras category-extras]: Functor instances depending on Functor |
| 55 | | * [http://hackage.haskell.org/package/cgi cgi]: Functor instances depending on Functor |
| 56 | | * [http://hackage.haskell.org/package/encoding encoding]: instance collision: Monad Either |
| 57 | | * [http://hackage.haskell.org/package/logict logict]: instance collision: Applicative Identity (will be superfluous: same as instance in transformers) |
| 58 | | * [http://hackage.haskell.org/package/monad-param monad-param]: Functor instances depending on Functor |
| 59 | | * [http://hackage.haskell.org/package/mueval mueval]: Functor instances depending on Functor |
| 60 | | * [http://hackage.haskell.org/package/xcb-types xcb-types]: instance collision: Applicative/Alternative ReaderT (will be superfluous: same as instance in transformers; version 0.5.1.1 has mtl < 1.2) |
| 61 | | * [http://hackage.haskell.org/package/xmonad-contrib xmonad-contrib]: instance collision: Error [a]: |
| 62 | | |
| 63 | | Data constructors for basic monad classes: |
| 64 | | |
| 65 | | * [http://hackage.haskell.org/package/FileManip FileManip]: Missing data constructor: State |
| 66 | | * [http://hackage.haskell.org/package/HAppS-Server HAppS-Server]: Missing data constructor: Reader |
| 67 | | * [http://hackage.haskell.org/package/HaLeX HaLeX]: Missing data constructor: State |
| 68 | | * [http://hackage.haskell.org/package/LambdaHack LambdaHack]: Missing data constructor: State (version 0.1.20090606 has mtl < 2) |
| 69 | | * [http://hackage.haskell.org/package/lambdabot lambdabot]: Missing data constructor: State |
| 70 | | * [http://hackage.haskell.org/package/open-witness open-witness]: Missing data constructor: State |
| 71 | | |
| 72 | | Instances for basic monad classes that are now type synonyms: |
| 73 | | |
| 74 | | * [http://hackage.haskell.org/package/applicative-extras applicative-extras]: instance Applicative (State a) (will be superfluous: same as instance in transformers) |
| 75 | | * [http://hackage.haskell.org/package/derive derive]: instance Applicative (Writer a) (will be superfluous: same as instance in transformers) |
| 76 | | * [http://hackage.haskell.org/package/random-fu random-fu]: instance MonadRandom (State StdGen) (will be superfluous: same instance as declared for StateT) |
| 77 | | * [http://hackage.haskell.org/package/yhccore yhccore]: instance UniqueIdM (State a) (could be trivially generalized to StateT) |
| | 47 | In early September 2010, there were 694 packages in hackage that directly depended on mtl. Of these, |
| | 48 | * 385 built unchanged with the proposed mtl-2 |
| | 49 | * 18 had a bounded mtl dependency that excluded mtl-2 |
| | 50 | * 2 failed because of the recent move of the Monad (Either e) instance |
| | 51 | * 43 failed with the new mtl: |
| | 52 | * 12 because they defined their own Applicative instances (which can now be deleted) |
| | 53 | * 12 because of the changed constraint on Functor instances |
| | 54 | * 1 that defined an overlapping Error instance |
| | 55 | * 18 that used the constructors of base monads |
| | 56 | * 246 failed for other reasons (e.g. failed anyway or depended on one of the other failures) |