method definitions fail to refer to method-context classes
Sorry in advance if this is my lack of understanding...[[BR]] The following code fails:[[BR]]
class Cfoo a where f :: Int -> a -> Int data Foo = F Int instance Cfoo Foo where f m (F n) = m + n data Bar = B Int class Cbar a where g :: (Cfoo b) => a -> b instance Cbar Bar where g (B m) = F m
Couldn't match expected type `b' against inferred type `Foo' `b' is a rigid type variable bound by the type signature for `g' at [...] In the expression: F m In the definition of `g': g (B m) = F m In the instance declaration for `Cbar Bar'
It's as if the "instance Cfoo Foo" statement is ignored when processing "instance CBar Bar"
|Component||Compiler (Type checker)|