[Haskell-cafe] class default method proposal

Yitzchak Gale gale at sefer.org
Wed Dec 12 08:31:21 EST 2007


Simon Peyton-Jones wrote:
>     Given "instance C T where ...", for any method 'm' not
>     defined by "...":
>         for every class D of which C is a superclass
>         where there is an instance for (D T)
>         see if the instance gives a binding for 'm'
>     If this search finds exactly one binding, use it,
>         otherwise behave as now

A better rule would be:

If this search finds exactly one binding that is
minimal in the partial ordering defined by the
superclass hierarchy, use it, otherwise behave
as now.

Would that be much harder to implement?

-Yitz


More information about the Haskell-Cafe mailing list