[GHC] #8634: Code valid in GHC 7.6 is impossible to move over GHC 7.7 (because of liberal coverage condition)
GHC
ghc-devs at haskell.org
Fri Dec 27 18:05:11 UTC 2013
#8634: Code valid in GHC 7.6 is impossible to move over GHC 7.7 (because of
liberal coverage condition)
-----------------------------------+---------------------------------------
Reporter: danilo2 | Owner:
Type: bug | Status: new
Priority: high | Milestone:
Component: Compiler | Version: 7.7
Resolution: | Keywords:
Operating System: | Architecture: Unknown/Multiple
Unknown/Multiple | Difficulty: Unknown
Type of failure: None/Unknown | Blocked By:
Test Case: | Related Tickets: #1241, #2247, #8356
Blocking: |
-----------------------------------+---------------------------------------
Changes (by rwbarton):
* related: => #1241, #2247, #8356
Comment:
{{{#!haskell
class Method1 cls m func | cls -> m, cls -> func where ...
}}}
This means "for any type `cls`, there must be at most one type `func` for
which there is an instance `Method1 cls m func`". (And the same for `m`.)
{{{#!haskell
instance (out ~ (t1->t1)) => Method1 (Vector a) Vector_testid out where
...
}}}
This defines instances like `Method1 (Vector Bool) Vector_testid (Int ->
Int)`, `Method1 (Vector Bool) Vector_testid (Char -> Char)`, etc., so it
violates the functional dependency. So, it was a (long-standing) bug that
GHC 7.6 allowed this instance declaration.
See the related tickets for further discussion.
As for how to fix your program: it's hard to see what's going on with the
`Call` type class, but can you try dropping both functional dependencies
and writing
{{{#!haskell
instance (m ~ Vector_testid, out ~ (t1->t1)) => Method1 (Vector a) m out
where ...
}}}
I'll leave this ticket open as several people have asked for an option to
relax this functional dependency sanity condition, but I don't think it's
a very good idea myself; the condition seems to usually catch real bugs.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8634#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list