[GHC] #5978: Type error in one function causes wrong type error report in another function in the presence of functionally dependent types
GHC
cvs-ghc at haskell.org
Thu Mar 29 09:58:14 CEST 2012
#5978: Type error in one function causes wrong type error report in another
function in the presence of functionally dependent types
----------------------------------------+-----------------------------------
Reporter: Lemming | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler (Type checker) | Version: 7.4.1
Keywords: | Os: Unknown/Multiple
Architecture: Unknown/Multiple | Failure: GHC rejects valid program
Difficulty: Unknown | Testcase:
Blockedby: | Blocking:
Related: |
----------------------------------------+-----------------------------------
Comment(by Lemming):
Sorry ... monoFoo is correct and monoBar is incorrect.
But when I compile that module GHC reports two type errors: One for
monoFoo and one for monoBar.
If I remove monoBar, then monoFoo is accepted by GHC.
The result of monoBar is Double, thus fromB=Double.
The argument of polyBar in monoBar is of type Float, thus fromA=Float.
From the functional dependencies it follows toB=Bool and toA=Char.
Thus id would need type Char -> Bool, which is a type error and this one
is correctly spotted by GHC.
But additionally also a type error for monoBar is reported, although
monoBar is correct.
It has type Float and it follows to=Char, but the 'to' type is not used in
monoBar.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5978#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list