
24 Mar
2005
24 Mar
'05
3:14 a.m.
Iavor Diatchki wrote:
Just to avoid confusion I think the suggestions were: class Functor f => Monad f where ... class Functor f => FunctorM f where ...
I know the first one differs from the Haskell report, but perhaps this is a flaw in the library design that should be fixed.
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... -- Thomas H