[Haskell-cafe] Which type variables are allowed in a context?

Vladimir Reshetnikov v.reshetnikov at gmail.com
Sun May 31 03:24:06 EDT 2009


Hi,

Consider this (a bit pathological) Haskell code:

--------------------------------------
class A a where
  foo :: A (b d) => a (c b)
--------------------------------------

GHC compiles it successfully, but Hugs rejects it:

Ambiguous type signature in class declaration
*** ambiguous type : (A a, A (b c)) => a (d b)
*** assigned to    : foo

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

Thanks,
Vladimir


More information about the Haskell-Cafe mailing list