#2882: variable escaping in existential type error on 6.8 but not 6.10
-----------------------------+----------------------------------------------
Reporter: ckeen | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler
Version: 6.10.1 | Severity: normal
Keywords: | Testcase:
Os: Unknown/Multiple | Architecture: x86
-----------------------------+----------------------------------------------
I wrote a patch for darcs that does the following:
{{{
'l' -> do let selected = case get_choices pc of
(first_chs:>_:>last_chs) ->
if whichch == Last || whichch
== FirstReversed
then last_chs else
first_chs
putStrLn $ "---- Already selected "++things++" ----"
mapM_ putDocLn $ mapFL (\a ->
showPatch `unseal2` (seal2 $ tp_patch a)) selected
}}}
where
{{{
get_choices :: Patchy p => PatchChoices p C(x y) -> (FL (TaggedPatch p) :>
FL (TaggedPatch p) :> FL (TaggedPatch p)) C(x y)
data (a1 :> a2) C(x y) = FORALL(z) (a1 C(x z)) :> (a2 C(z y))
data FL a C(x z) where
(:>:) :: a C(x y) -> FL a C(y z) -> FL a C(x z)
NilFL :: FL a C(x x)
}}}
This gives an error with ghc-6.8.2 on Mac OS X (others have reported
errors with 6.8.3 as well):
{{{
Inferred type is less polymorphic than expected
Quantified type variable `z2' escapes
When checking an existential match that binds
first_chs :: FL (TaggedPatch p) x z1
last_chs :: FL (TaggedPatch p) z2 z
The pattern(s) have type(s): (:>)
(FL (TaggedPatch p))
(FL (TaggedPatch p) :> FL (TaggedPatch
p))
x
z
The body has type: FL (TaggedPatch p) z2 z
In a case alternative:
(first_chs :> _ :> last_chs)
-> if whichch == Last || whichch == FirstReversed then
last_chs
else
first_chs
In the expression:
case get_choices pc of
(first_chs :> _ :> last_chs)
-> if whichch == Last || whichch == FirstReversed then
last_chs
else
first_chs
}}}
I have been convinced that this is indeed a programming error by the fine
people on #ghc. So the remaining question is: Why does it work on
ghc-6.10.1?
I will try if I can construct a simpler test case.
Thanks,
Christian
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2882>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs