Ticket #1241 (closed bug: fixed)
Functional dependency Coverage Condition is lifted, and should not be
| Reported by: | guest | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | _|_ |
| Component: | Compiler (Type checker) | Version: | 6.6 |
| Keywords: | Cc: | sulzmann@… | |
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | None/Unknown | Difficulty: | Unknown |
| Test Case: | Blocked By: | ||
| Blocking: | Related Tickets: |
Description (last modified by simonpj) (diff)
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
Change History
Note: See
TracTickets for help on using
tickets.
