id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,os,architecture,failure,testcase,blockedby,blocking,related,differential,wikipage
6100,mistake in class inheritance system,guest,,"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
",bug,closed,normal,,Compiler,7.4.1,invalid,class inheritance,rma-karpichev@…,Linux,x86,GHC rejects valid program,,,,,,