-----------------------------------------------
class A a where
 foo :: a b

class B a

class (A a, B a) => C a
-----------------------------------------------

GHC compiles it without errors, but Hugs rejects it: "Illegal type in
class constraint".

The error message is horribly uninformative.

What is the correct behavior, and which part of the haskell 98 report
explains this?

4.6 Kind Inference, combined with 4.5(.1) dependency analysis.

My interpretation: 'A' and 'B' are not in the same dependency group,
so 'a's kind in 'B' defaults to '*', so 'C' is ill-kinded. Try moving 'B'
into a separate module to get the same effect in GHC (which, in the
single-module case, uses 'A' and 'C' to determine the kind of 'B's 'a').

Claus


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to