[GHC] #8356: Strangeness with FunDeps
GHC
ghc-devs at haskell.org
Wed Sep 25 14:55:41 CEST 2013
#8356: Strangeness with FunDeps
----------------------------------------------+----------------------------
Reporter: ksf | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.7
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: GHC rejects valid program | Unknown/Multiple
Test Case: | Difficulty: Unknown
Blocking: | Blocked By:
| Related Tickets:
----------------------------------------------+----------------------------
Comment (by rwbarton):
The error makes sense to me: `sy`, `a`, `b` and `((sy ::: a) ': xs)` do
not jointly determine `((sy ::: b) ': ys)`, because the whole `ys` part is
free. (And the same for the other fundep.)
Perhaps the error message could be more specific, saying what I said
above? something like
{{{
Illegal instance declaration for [...]
Multiple uses of this instance may be inconsistent
with the functional dependencies of the class:
`sy', `a', `b' and `((sy ::: a) ': xs)' do not
jointly determine `((sy ::: b) ': ys)'
}}}
Extra clarity would be good here since there are existing libraries that
use fundeps incorrectly, that will stop compiling in 7.8, and I anticipate
a slew of bug reports otherwise. See for example
http://ghc.haskell.org/trac/ghc/ticket/1241#comment:22.
> What I'm trying to do is to express "xs is ys and ys is xs with a and b
interchanged at sy", all in a single predicate because my current type
family implementation needs two and explodes the inferred types.
In that case, perhaps you intended
{{{
instance Replaced sy a b ((sy ::: a) ': xs) ((sy ::: b) ': xs) -- note xs
twice
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8356#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list