The FunctorM library

Thomas Hallgren hallgren at cse.ogi.edu
Wed Mar 23 22:14:41 EST 2005


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



More information about the Libraries mailing list