[Haskell-cafe] type class constraints headache

Rahul Kapoor rk at trie.org
Thu Mar 4 01:53:57 EST 2010


>I am trying to understand the mechanism behind --
> why does the first example compile and what constraints does
> enumerateMethodNames add on a (which it does not inspect)?

enumerateMethodNames does not add on any constraints. If you
don't actually use "methods" GHC does not care what it's type is
but the moment you use it some place the compiler needs to infer
it's type which it is unable to do in your case because
the "undefined"s can be of any type.

HTH
Rahul


More information about the Haskell-Cafe mailing list