Simon Peyton-Jones wrote:
Is this the most up-to-date description of the proposal?
http://repetae.net/recent/out/classalias.html
Has anyone looked at my (confusingly named and horribly written) variant?
http://haskell.org/haskellwiki/Superclass_defaults
My idea is to split class aliases into two separate things:
1. Superclass defaults: allow a class declaration to contain defaults for
methods from superclasses. Allow an instance declaration to be for multiple
classes at once, using the most specific defaults:
instance (FooBar a, Foo a, Bar a)
-- pick the defaults from FooBar, since it is a subclass
-- of both Foo and Bar.
2. Class aliases: simply an alias for zero or more classes.
class alias FooAndBar a = (Foo a, Bar a)
In a context FooAndBar a is simply replaced by (Foo a, Bar a). For
instantiation purposes the class alias could override the default methods as if
it was a subclass of Foo and Bar. No new methods can be added.
Alternatively class aliases could be just macros, like type synonyms.
Part 1 applies for instance to the Functor/Applicative/Monad hierarchy, fmap
could have a default in terms of (>>=).
Part 2 is useful for splitting classes up into smaller bits.
Twan
_______________________________________________
Haskell-prime mailing list
Haskell-prime@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-prime