Functor instance of ReaderT
lemming at henning-thielemann.de
Thu Aug 7 03:22:19 EDT 2008
On Tue, 5 Aug 2008, Benja Fallenstein wrote:
> On Tue, Aug 5, 2008 at 2:19 PM, Henning Thielemann
> <lemming at henning-thielemann.de> wrote:
> > The Functor instance of ReaderT has the header:
> > Monad m => Functor (ReaderT r m)
> > I thought (Functor m) must be the appropriate constraint.
> Note that there *is* an advantage to having Monad as the context: not
> every monad implements Functor, even though it could. So having
> Functor as the context isn't *trivially* superior.
I know, but if a Monad instance exists, then the Functor instance can be
simply added, whereas when the opposite direction is not always possible.
So, lifting the constraint from Monad to Functor can break existing
packages, but the problems are "easy to fix" (TM). :-)
More information about the Libraries