Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,252
    • Issues 5,252
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 562
    • Merge requests 562
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #7022
Closed
Open
Issue created Jun 21, 2012 by Richard Eisenberg@raeDeveloper

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
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking