atom feed35 messages in org.haskell.haskell[Haskell] PROPOSAL: class aliases
FromSent OnAttachments
John MeachamOct 12, 2005 7:41 pm 
Philippa CowderoyOct 12, 2005 7:55 pm 
John MeachamOct 12, 2005 8:16 pm 
Wolfgang JeltschOct 13, 2005 5:48 am 
John MeachamOct 13, 2005 6:03 am 
Malcolm WallaceOct 13, 2005 6:15 am 
Andres LoehOct 13, 2005 6:23 am 
Malcolm WallaceOct 13, 2005 6:29 am 
John MeachamOct 13, 2005 6:37 am 
John MeachamOct 13, 2005 6:39 am 
Simon Peyton-JonesOct 13, 2005 7:02 am 
Benjamin FranksenOct 13, 2005 7:26 am 
Benjamin FranksenOct 13, 2005 7:33 am 
S.M.KahrsOct 13, 2005 7:37 am 
John MeachamOct 13, 2005 8:32 am 
Simon Peyton-JonesOct 13, 2005 9:23 am 
Udo StenzelOct 13, 2005 9:46 am 
Jan-Willem MaessenOct 13, 2005 9:58 am 
Paul GovereauOct 13, 2005 1:21 pm 
Jacques CaretteOct 13, 2005 1:52 pm 
John MeachamOct 13, 2005 4:45 pm 
John MeachamOct 13, 2005 6:13 pm 
John MeachamOct 13, 2005 6:21 pm 
David MenendezOct 13, 2005 6:49 pm 
John MeachamOct 13, 2005 8:33 pm 
aj...@spamcop.netOct 13, 2005 11:25 pm 
Ashley YakeleyOct 14, 2005 6:20 am 
Ashley YakeleyOct 14, 2005 6:31 am 
Wolfgang JeltschOct 14, 2005 9:46 am 
Wolfgang JeltschOct 14, 2005 11:44 am 
Wolfgang JeltschOct 14, 2005 11:47 am 
Remi TurkOct 14, 2005 2:05 pm 
Udo StenzelOct 15, 2005 6:15 am 
Ross PatersonOct 27, 2005 6:58 am 
Wolfgang JeltschOct 28, 2005 7:05 am 
Subject:[Haskell] PROPOSAL: class aliases
From:Jan-Willem Maessen (jmae@alum.mit.edu)
Date:Oct 13, 2005 9:58:43 am
List:org.haskell.haskell

On Oct 12, 2005, at 8:00 PM, John Meacham wrote:

[longish proposal for class aliases]

Very nicely done, by the way.

== Notes ==

* class aliases are also able to introduce new superclass constraints, such as in the Num example we also want to enforce a (Eq a, Show a) superclass constraint. the interpretation is straightforward, Num in type signatures expands as if those were part of the alias and when declaring instances the existence of instances for the superclasses are checked, but not filled in automatically. I didn't show an example so as to not confuse the basic idea and because I have not come up with a syntax I am happy with. (suggestions welcome)

It sounds like there may be a simpler initial extension lurking under this, see below.

... * I had an earlier supertyping proposal you might know about, I feel this is a much better proposal even though it doesn't fully subsume my supertyping proposal, I feel it solves the problems it was meant to solve in a cleaner and easier to implement way.

Having read the previous proposal, I'm inclined to agree. I feel like I can explain this one in a couple of minutes, and the listener will be able to figure out most of the subtleties without additional help.

* You may wonder why for the num example I put Additive a in the class alias even though it was already a superclass of AdditiveNegation. that is because class aliases do not change the meaning of superclasses, you need to explicitly list a class if you want instance declarations to propagate methods to it. superclasses are checked just like normal in class aliases.

This is the one possible exception to that. Again, see below.

* incidental but not earth-shattering benefits include being able to declare an instance for a class and all its superclasses at once, smarter defaults when you are combining related classes, and much nicer type signatures by being able to create your own aliases for common combinations of classes.

It seems to me this is a simpler extension here which might serve at least as a conceptual stepping-stone to full class aliases---the ability to declare an instance for a class and all its superclasses at once. Given that ability, class aliases actually look like a relatively simple extension.

One final thing which would be nice is the ability to define instances of superclass methods in a subclass declaration. But this takes things in a different direction entirely.