Haskell' - class aliases

John Meacham john at repetae.net
Thu May 1 18:14:23 EDT 2008

On Thu, May 01, 2008 at 03:42:53PM +0100, Simon Peyton-Jones wrote:
> | Yeah, I disagree here, mainly because I don't want to conflate
> | superclasses with class aliases. I feel they have different uses, even
> | though they can sometimes achieve the same thing.
> Fair enough.  But the strange syntax
> class alias Num a = Eq a => (Additive a, Multiplicative a)
> *does* seem so say that the (Eq a) behaves in a superclass way, and
> (Additive a, Multiplicative a) behave in a class-alias way, as it
> were.  That seems inconsistent with the design goal you describe
> above.

Wolfgang suggested the alternate syntax

class alias Eq a => Num a = (Additive a, Multiplicative a) where ....

The correct reading being:

if 'Eq a' then 'Num a' is an alias for (Additive a,Multiplicative a)

I think I am coming around to his point of view, do you think this makes
it clearer?


John Meacham - ⑆repetae.net⑆john⑈

More information about the Haskell-prime mailing list