Ticket #3958 (closed bug: invalid)
method definitions fail to refer to method-context classes
Description
Sorry in advance if this is my lack of understanding...
The following code fails:
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
with error:
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"
Change History
Note: See
TracTickets for help on using
tickets.
