Functional dependency Coverage Condition is lifted, and should not be
Hello,
GHC 6.6 (with flags -fglasgow-exts -fallow-undecidable-instances
) is too liberal when accepting instances. Here is an example:
class F a b | a -> b where f :: (a,b)
instance F Int b
The instance violates the functional dependency constraint of F
because (in theory) it can be used to solve both F Int Bool
and F Int Char
. In practice, it seems that some free variable gets bound upon the first use of f
with a concrete type, leading to some rather confusing behavior. Example:
x :: (Int,a)
x = f
y :: (Int,Bool)
y = f
z :: (Int,Char)
z = x -- works, but 'z = f' does not
-Iavor