[Haskell] PROPOSAL: class aliases
wolfgang at jeltsch.net
Thu Oct 13 06:08:27 EDT 2005
Am Donnerstag, 13. Oktober 2005 02:00 schrieb John Meacham:
At a first look, this looks really nice.
> We allow new constructs of this form (the exact syntax is flexible of
> > class alias (Foo a, Bar a) => FooBar a where
> > foo = ...
> what this does is declare 'FooBar a' as an alias for the two constraints
> 'Foo a' and 'Bar a'. This affects two things.
Wouldn't it be better to write it this way:
class alias (Foo a, Bar a) = FooBar a where ...
(Foo a, Bar a) => FooBar a normally means that a type is an instance of Foo
and Bar if it is an instance of FooBar but in the case of aliases, a type is
also an instance of FooBar if it is an instance of Foo and Bar.
More information about the Haskell