[GHC] #1214: Iface type variable out of scope
GHC
trac at galois.com
Sun Mar 11 17:20:38 EDT 2007
#1214: Iface type variable out of scope
----------------------------------------+-----------------------------------
Reporter: igloo | Owner:
Type: bug | Status: new
Priority: normal | Milestone: 6.6.2
Component: Compiler (Type checker) | Version: 6.6
Severity: normal | Keywords:
Difficulty: Unknown | Testcase: gadt23
Architecture: Unknown | Os: Unknown
----------------------------------------+-----------------------------------
Christophe Poucet reports the below bug; the 6.6 branch is broken, but the
HEAD works.
----
While working some code I stumbled into a bug with GHC. Basically I have a
GADT that has a phantom-type for all but one of it's data constructors.
When
I try to store a record-type in that tag it gives me a problem due to
interfaces when I recompile something against the interface file
containing
the GADT. Namely, it complains that the type variable is out of scope.
The code in question (after treeing to find out what the actual problem
was,
namely the combination of GADTs with records) is the following:
{{{
-- AST.hs
{-# OPTIONS_GHC -fglasgow-exts #-}
module AST where
data Exp_;
data AST :: * -> * -> * where
Var :: String -> AST Exp_ tag
Tag :: tag -> AST a tag -> AST a tag
}}}
{{{
-- Main.hs
module Main where
import AST
data Foo = Foo { bar :: Int }
convert :: AST a tag -> AST a Foo
convert t = case t of
Var v -> Tag (Foo 42) $ Var v
Tag t e -> Tag (Foo 42) $ convert e
main = return ()
}}}
The bug is easily replicated with the following commands:
{{{
> ghc --make Main.hs
-- Works fine
> touch Main.hs
> ghc --make Main.hs
-- The interface for `main:AST'
-- Declaration for AST
-- Constructor AST.Tag:
-- Iface type variable out of scope: tag
-- Cannot continue after interface file error
> rm -f Main.hi Main.o AST.hi AST.o
> ghc --make Main.hs
-- Works fine
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1214>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list