Kind variable scoping problem in Iface file when using Template Haskell
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.
Trac metadata
Trac field | Value |
---|---|
Version | 7.5 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |