The FunctorM library

Benjamin Franksen benjamin.franksen at bessy.de
Thu Mar 24 06:39:40 EST 2005


On Thursday 24 March 2005 04:14, Thomas Hallgren wrote:
> 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...

Robert Will has written a fully specified proposal for this. He calls it 
"delayed method definition", see 
http://www.stud.tu-ilmenau.de/~robertw/dessy/fun/, sections 4.3.1 and 
4.3.2.

Looks like a really good idea to me.

Ben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org//pipermail/libraries/attachments/20050324/a7274f77/attachment.htm


More information about the Libraries mailing list