#1111: Too-eager variable capture in forall types
-------------------------+--------------------------------------------------
Reporter: japple | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 6.6
Severity: normal | Keywords:
Difficulty: Unknown | Testcase:
Architecture: x86 | Os: Linux
-------------------------+--------------------------------------------------
h's type is ineffable: GHCi infers Capture a, but listing that type in the
souce code fails the typecheck. Listing no type allows the following:
{{{
{-# OPTIONS_GHC -fglasgow-exts #-}
data Capture a = Base a
| Capture (Capture (forall x . Divide x -> Divide a))
g :: Capture (forall a . Divide a -> Divide a)
g = Base id
h = Capture g
l :: Capture a
l = h
m :: Capture Int
m = h
data Divide a where
Pint :: Int -> Divide Int
Pbool :: Bool -> Divide Bool
foo :: Capture a -> Divide a
foo (Capture (Base f)) = f (Pbool True)
unfoo :: Divide a -> a
unfoo (Pint x) = x
unfoo (Pbool x) = x
oops = unfoo (foo h) -- Illegal instruction
oopsAgain = unfoo (foo l) -- Illegal instruction
oopsOnceMore = unfoo (foo m)
{-
<interactive>: internal error: interpretBCO: hit a CASEFAIL
(GHC version 6.6 for i386_unknown_linux)
Please report this as a GHC bug:
http://www.haskell.org/ghc/reportabug
Aborted
-}
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1111>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs