Ticket #7022 (closed bug: fixed)
Kind variable scoping problem in Iface file when using Template Haskell
| Reported by: | goldfire | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.6.1 |
| Component: | Compiler | Version: | 7.5 |
| Keywords: | TemplateHaskell PolyKinds | Cc: | |
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | None/Unknown | Difficulty: | Unknown |
| Test Case: | polykinds/T7022 | Blocked By: | |
| Blocking: | Related Tickets: |
Description
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.
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

