[Haskell-cafe] Redefining superclass default methods in a subclass

Simon Peyton-Jones simonpj at microsoft.com
Tue Jan 9 09:42:25 EST 2007


One of the great things about John's class-alias proposal is that John worked out a lot of details and captured them in a web page, rather than it getting buried in an email thread.

If you have ideas to refine his proposal, it'd be good to see if, with him, you can come up with a unified design, and again capture it in a Wiki page or something.

For myself, I have not fully grokked either proposal, nor gotten a feel for their cost-benefit ratio.  But the more well-articulated a design is, the more likely it is for someone (at GHC HQ or elsewhere) to have a go at implementing it.  And of course one or two well-refined proposals are more attractive to implement than half a dozen intriguing but overlapping ones.

So this message is really to encourage you to collaborate on writing up type-system proposals, at least ones that you care about.

Simon

| -----Original Message-----
| From: haskell-cafe-bounces at haskell.org [mailto:haskell-cafe-bounces at haskell.org] On Behalf Of Roberto
| Zunino
| Sent: 04 January 2007 22:44
| To: Brian Hulley
| Cc: Haskell-cafe
| Subject: Re: [Haskell-cafe] Redefining superclass default methods in a subclass
|
| Brian Hulley wrote:
| > Hi,
| > Looking at some of the ideas in
| > http://www.haskell.org/haskellwiki/The_Other_Prelude , it struck me that
| > the class system at the moment suffers from the problem that as
| > hierarchies get deeper, the programmer is burdened more and more by the
| > need to cut-and-paste method definitions between instances because
| > Haskell doesn't allow a superclass (or ancestor class) method default to
| > be redefined in a subclass.
|
| The class aliases proposal lists several similar shortcomings of the
| current class system.
|
| http://repetae.net/john/recent/out/classalias.html
|
| > Perhaps there is some reason this can't be done?
|
| Some random thoughts:
|
| How one would write instances? Using your Monad class, does
|     instance Monad F where
|        return = ...
|        (>>=) = ...
| automatically define an instance for Applicative?
|
| If it does: What if there already is such an instance? Which one gets
| used for (>>)? The user-defined one or the Monad default? Is separate
| compilation still possible? (If there is no instance right now, one
| might pop out in another module...)
|
| If it does not: How can one define it, without copy-and-pasting the default?
|
| Zun.
| _______________________________________________
| Haskell-Cafe mailing list
| Haskell-Cafe at haskell.org
| http://www.haskell.org/mailman/listinfo/haskell-cafe


More information about the Haskell-Cafe mailing list