#6100: mistake in class inheritance system
---------------------------------------+------------------------------------
Reporter: guest | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler
Version: 7.4.1 | Keywords: class inheritance
Os: Linux | Architecture: x86
Failure: GHC rejects valid program | Testcase:
Blockedby: | Blocking:
Related: |
---------------------------------------+------------------------------------
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
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6100>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs