(I'm using GHC 4.04 patchlevel 1...)

Suppose I have a type involving higher kinds such as

  data H f a = H (f a)

and now suppose I want to define equality on this type.
I *cannot* say

  instance Eq (f a) => Eq (H f a) where
    H x == H y = x == y

because I get an error message

  Illegal constaint `Eq (f a)' in instance context
    (Instance contexts must constrain only type variables)

(BTW, typo in "constaint"...)

However, I *can* say

  data H f a = H (f a)  deriving (Eq)

which presumably generates code internally that is *identical*
to the instance declaration I tried to write.

Is this inconsistency between what can be written manually
and what can be derived deliberate?

-Chris

Reply via email to