[GHC] #7022: Kind variable scoping problem in Iface file when using Template Haskell
GHC
cvs-ghc at haskell.org
Thu Jun 21 22:22:46 CEST 2012
#7022: Kind variable scoping problem in Iface file when using Template Haskell
------------------------------+---------------------------------------------
Reporter: goldfire | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler
Version: 7.5 | Keywords: TemplateHaskell PolyKinds
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: None/Unknown | Testcase:
Blockedby: | Blocking:
Related: |
------------------------------+---------------------------------------------
Consider the following modules:
{{{
module PolykindTH where
import Language.Haskell.TH
makeSList :: Q [Dec]
makeSList = do
a <- newName "a"
k <- newName "k"
return [TySynD (mkName "SList") [KindedTV a (AppT ListT (VarT k))]
(AppT (ConT (mkName "Sing")) (VarT a))]
-- makes "type SList (a :: [k]) = Sing a"
}}}
{{{
{-# LANGUAGE PolyKinds, TypeFamilies, DataKinds, TemplateHaskell #-}
module Polykind where
import PolykindTH
data family Sing (a :: k)
$( makeSList )
}}}
When these modules are compiled, the resultant Iface file fails to load
when code attempts to use the modules. To check this, I packaged this up
with a cabal file, registered the package with my GHC (7.5.20120620), and
then attempted to compile the following:
{{{
import Polykind
foo :: SList a -> Bool
foo = undefined
}}}
Here is the error:
{{{
Declaration for SList:
Iface type variable out of scope: k
Cannot continue after interface file error
}}}
I have attached a tarball of my cabal package for ease of testing.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7022>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list