mistake in class inheritance system
class can't use function of parents class. Code:
class A a where
toInt | a -\> Int |
---|---|
func | a -\> a -\> Int |
class (A a) => B a where
toInteger :: a -> Integer
f :: (A a) => (B b) => a -> b -> Int
f a b = func a b
We must be able to use (func a b) because (func :: a -> a -> Int) and b is member of A class.
error:
Could not deduce (b ~ a)
from the context (A a, B b)
bound by the type signature for f | (A a, B b) =\> a -\> b -\> Int |
---|---|
at bug.hs:9:1-16 | |
`b' is a rigid type variable bound by the type signature for f :: (A a, B b) => a -> b -> Int at bug.hs:9:1 `a' is a rigid type variable bound by | |
the type signature for f | (A a, B b) =\> a -\> b -\> Int |
at bug.hs:9:1 | |
In the second argument of `func', namely `b' | |
In the expression: func a b | |
In an equation for \`f': f a b = func a b |
Trac metadata
Trac field | Value |
---|---|
Version | 7.4.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | rma-karpichev@rambler.ru |
Operating system | |
Architecture |