Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • 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 4,826
    • Issues 4,826
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 443
    • Merge requests 443
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #15437

Closed
Open
Created Jul 25, 2018 by dminuoso@dminuosoReporter

Internal error when applying a scoped type variable inside a typed expression quotation

{-# LANGUAGE TemplateHaskell #-}

import TestMod

f :: Int
f = $$(foo)

main :: IO ()
main = main
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeApplications #-}

module TestMod where

import Language.Haskell.TH.Syntax (Q, TExp)

get :: forall a. Int
get = 1

foo :: forall a. Q (TExp Int)
foo = [|| get @a ||]
Test.hs:6:8: error:
    • The exact Name ‘a’ is not in scope
        Probable cause: you used a unique Template Haskell name (NameU),
        perhaps via newName, but did not bind it
        If that's it, then -ddump-splices might be useful
    • In the result of the splice:
        $foo
      To see what the splice expanded to, use -ddump-splices
      In the Template Haskell splice $$(foo)
      In the expression: $$(foo)
  |
6 | f = $$(foo)
  |        ^^^

Test.hs:6:8: error:
    • GHC internal error: ‘a’ is not in scope during type checking, but it passed the renamer
      tcl_env of environment: [r3Kl :-> Identifier[f::Int, TopLevelLet [] True],
                               r3PI :-> Identifier[main::IO (), TopLevelLet [r3PI :-> main] True]]
    • In the type ‘a’
      In the expression: get @a
      In the result of the splice:
        $foo
      To see what the splice expanded to, use -ddump-splices
  |
6 | f = $$(foo)
  |
Trac metadata
Trac field Value
Version 8.4.3
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