
On Wed, Mar 7, 2012 at 7:43 PM, Ross Paterson
Seeking views before a new major release of transformers package. The docs are here:
http://code.haskell.org/~ross/transformers/dist/doc/html/transformers/
The source is here:
darcs get http://code.haskell.org/~ross/transformers
The major changes from version 0.2.2.0 are:
* Foldable and Traversable instances for transformers that support them. * extra Monad instances:
instance (MonadFix m) => MonadFix (MaybeT m) instance (MonadFix m) => MonadFix (IdentityT m) instance (Monad f, Monad g) => Monad (Product f g) instance (MonadPlus f, MonadPlus g) => MonadPlus (Product f g) instance (MonadFix f, MonadFix g) => MonadFix (Product f g)
* new functors Backwards and Reverse * a new Lift transformer, a generalization of Errors * generalized constructor functions:
state :: Monad m => (s -> (a, s)) -> StateT s m a reader :: Monad m => (r -> a) -> ReaderT r m a writer :: Monad m => (a, w) -> WriterT w m a
Hrmm. If the definitions of 'modify' ran through 'state' they could avoid a round trip through the monad. Another issue that has been raised is: should the instance
instance Monad (ContT r m)
have a Monad constraint so that it can define fail?
Ick. One of the things I liked about the recent change that brought the monad instance for Either into Control.Monad.Instances was that we didn't go out of our way to screw up a perfectly good monad in order to better support fail, and the same argument could be applied to pollute Codensity, which also currently requires nothing of 'm', but which has ContT r m-like uses involving types like Endo. I'm not a fan of 'slippery slope' arguments, but this strikes me as a slippery slope. ;) -Edward