Changes between Version 6 and Version 7 of Proposals/transformers
- Timestamp:
- 09/15/10 00:18:20 (3 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Proposals/transformers
v6 v7 13 13 14 14 The idea is to factor out the monad transformers as a Haskell 98 package, which can be used by itself or with type classes based on either functional dependencies or type functions. Interfaces referring to the monad transformers would be compatible across the different libraries. 15 16 The transformers package has been in use for over 18 months, and is used by more than 100 packages. It is time to complete the transition, and save authors from having to worry about two distinct monad transformer packages. 15 17 16 18 == Structure == … … 43 45 44 46 ''Rationale:'' These instances are more general, and are consistent with the instances of other classes. 45 * simple monads now aliases for monad trasformers applied to {{{Identity}}}, e.g.47 * simple monads are now aliases for monad trasformers applied to {{{Identity}}}, e.g. 46 48 {{{ 47 49 newtype Reader r a = Reader { runReader :: r -> a } … … 55 57 }}} 56 58 ''Rationale:'' This avoids repetition in the interfaces of both transformers and the proposed mtl-2. It makes transformers more useful on its own, and also saves clients of mtl from defining instances for both {{{State s}}} and {{{StateT s Identity}}} and ensuring that they are consistent. 57 58 == Other issues ==59 60 Some other issues have been raised with mtl over the years, but they are orthogonal to this proposal:61 * 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.62 * The {{{ErrorT}}} monad transformer has an {{{Error}}} constraint, so that errors can be passed to the fail method of the Monad class.63 * {{{ListT}}} only works on commutative monads.64 59 65 60 == Transition issues == … … 76 71 * 2 that defined instances for base monads ([http://hackage.haskell.org/package/jmacro jmacro] and [http://hackage.haskell.org/package/yhccore yhccore]) 77 72 * 248 failed for other reasons (e.g. failed anyway or depended on one of the other failures) 73 74 == Other issues == 75 76 Some other issues have been raised with mtl over the years, but they are orthogonal to this proposal: 77 * 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. 78 * The {{{ErrorT}}} monad transformer has an {{{Error}}} constraint, so that errors can be passed to the fail method of the Monad class. 79 * {{{ListT}}} only works on commutative monads.
