Coverage Condition cannot be turned off
Compile this program
{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies #-}
module Bug1 where
class C a b | a -> b
data A a = A
data B a = B
instance C (A a) (B b)
and observe the error message
Bug1.hs:9:10:
Illegal instance declaration for `C (A a) (B b)'
The coverage condition fails in class `C'
for functional dependency: `a -> b'
Reason: lhs type `A a' does not determine rhs type `B b'
In the instance declaration for `C (A a) (B b)'
Then read manual, sec 7.6.3.3:
Both the Paterson Conditions and the Coverage Condition are lifted if you give the -XUndecidableInstances flag
Compile again with -XUndecidableInstances. Observe the exact same error message.
Either the compiler or the documentation is wrong. I certainly hope it is the compiler, because it worked in 7.6 and was quite useful.
Trac metadata
Trac field | Value |
---|---|
Version | 7.8.2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |