[Haskell] The FunctorM library
Simon Peyton-Jones
simonpj at microsoft.com
Thu Mar 24 03:40:14 EST 2005
| > Yes, I think this should be fixed, and perhaps it could be done in a
| > backward compatible way? If classes were allowed to declare default
| > methods for superclasses, then you could have
| >
| > class Functor f where fmap :: ...
| > class Functor m => Monad m where
| > ...the usual stuff...
| > fmap = liftM
| >
| > Then declaring
| >
| > instance Monad T where ...
| >
| > for some T, would implicitly introduce an instance Functor T, if it
is
| > not defined explicitly...
It seems overkill to have a whole new language feature to deal with one
library issue. It would take a bit of implementing too, and it's not
clear to me what the specification is. For example, what if Functor T
*is* defined explicitly, but in a later module?
The idea comes up very occasionally, but I wouldn't say it's been a hot
issue.
Simon
More information about the Haskell
mailing list