[Haskell-cafe] mtl tweaks

Nicolas Frisby nicolas.frisby at gmail.com
Sun Jan 21 13:37:02 EST 2007

There have been some discussions of augmentations of the monad
transformer library. I at least know there was a discussion regarding
strictness of state/value components in the state monad transformer (I
must admit I didn't track the conclusion of that one).

I have another small mtl complaint: ReaderT, for example, requires the
base type to be a Monad in order to make it a Functor. So it's Monad m
=> Functor (ReaderT r m) instead of Functor f => Functor (ReaderT r
f), which is what's actually necessary for the instance. Remember, I
did say _small_ complaint.

I realize this has a bit to do with the class heirarchy and that's a
sensitive issue. Regarding backwards compatibility and interface
changes, note that the Monad m => Monad (ReaderT r m) instance would
be unaffected by this... it's only the Functor => Functor instance. If
someone wants to treat a transformed monad as a functor, then they're
probably savvy enough to specify the base monad as a functor
(especially with the @fmap f = (>>= return . f)@ recipe). They won't
even see a difference unless they are rolling their own monad, since
all mtl monads are also functors.

1) Is there a collection of these suggestions specifically for mtl? On
the wiki? On the bug tracker?
2) Any chance we could make this change to the library?


More information about the Haskell-Cafe mailing list