[Haskell-cafe] class default method proposal

David Menendez dave at zednenem.com
Tue Dec 11 10:19:53 EST 2007

On Dec 11, 2007 9:20 AM, Duncan Coutts <duncan.coutts at worc.ox.ac.uk> wrote:

> So my suggestion is that we let classes declare default implementations
> of methods from super-classes.


> Does this proposal have any unintended consequences? I'm not sure.
> Please discuss :-)

It creates ambiguity if two classes declare defaults for a common

My standard example involves Functor, Monad, and Comonad. Both Monad and
Comonad could provide a default implementation for fmap. But let's say I
have a type which is both a Monad and a Comonad: which default
implementation gets used?

I'm disappointed to see this objection isn't listed on the wiki.

Dave Menendez <dave at zednenem.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20071211/6a534984/attachment.htm

More information about the Haskell-Cafe mailing list