That's approximately what I was describing, yes.  Thanks!

On Fri, May 3, 2013 at 7:54 AM, Guy <> wrote:

> David Thomas wrote:
>> I'd also like to see these two.  It occurs to me there may be language
>> tweak that could reduce breakage and add some
>> convenience in both cases.  It would not surprise me at all if this has
>> been thought of, examined, and discarded, but I
>> don't have time to dig so I'll just lay it out quickly, and if it has
>> been discussed before someone will probably know
>> where.
>> The idea is to allow definitions of superclass operations in subclass
>> instances.  If there are such definitions, it's
>> treated as if there were instances defined for each class (potentially a
>> source translation, even).  I think default
>> definitions of superclass operations in the subclass would be used last
>> (that is, only for the automatic instance of the
>> superclass, and only if the superclass didn't have a default for that).
>> This should allow existing instances of Num to just work (and I think
>> Monad too, with some care).  It would also mean if
>> you're making something that's a Monad or a Num you could just lay out
>> the one instance in all one place, reducing a bit
>> of boilerplate.  At the same time, you'd have the flexibility to just use
>> the superclasses where you just want pieces.
> I'm surprised that the various superclass proposals haven't got more
> attention, seeing as it would allow for this kind of class hierarchy
> clean-up without breaking lots of code.
> ______________________________**_________________
> Haskell-Cafe mailing list
Haskell-Cafe mailing list

Reply via email to