[Haskell] PROPOSAL: class aliases

ajb at spamcop.net ajb at spamcop.net
Thu Oct 13 23:45:12 EDT 2005


G'day all.

Quoting Simon Peyton-Jones <simonpj at microsoft.com>:

> I've considered this before, but never done anything about it because
> superclasses are so close.  Specifically, what is the difference between
>
> (i)	class (C a, D a) => CD a
> and
> (ii)	class alias CD a = (C a, D a)
>
> Note that (i) is Haskell 98.

To be a true typeclass synonym, there would also be an implied default
instance:

    class (C a, D a) => CD a
    instance (C a, D a) => CD a

...and this is not Haskell 98.

Cheers,
Andrew Bromage


More information about the Haskell mailing list