Sergey Mechveliani writes:
> Second, some compilers say at this:
> "
> (the instance type must be of form (T a b c)
> where T is not a synonym, and a,b,c are distinct type variables)
> "
> Maybe, they treat  Int Int  as a repeated variable?

Not quite, Int isn't a type variable at all, but an actual type.
Basically it's disallowing instance heads more than one type
constructor deep.  So for example, "instance C (T Int Char)" would
also be disallowed.

It isn't necessary for this to be anything like this restrictive, of
course, but basically it's (a sledgehammer) to enforce (the nut of)
non-overlap of instances.

SPJ et al proposed relaxing this for [Standard] Haskell [2.0],
and ghc will allow the more general cases with -fgla-exts, provided
the instances don't _actually_ overlap.  (Older versions of ghc
(3.00?) allow some overlap, too)

Slainte,
Alex.


Reply via email to