Skip to content

Misleading error message when quasiquoter not in scope

t.hs:

{-# LANGUAGE QuasiQuotes #-}
main = [$notDefinedHere| |]

ghc's output:

t.hs:2:7: Not in scope: `notDefinedHere'

t.hs:2:7:
    GHC stage restriction: notDefinedHere
      is used in a quasiquote, and must be imported, not defined locally
Failed, modules loaded: none.

The second message is wrong, since notDefinedHere isn't defined anywhere.

Trac metadata
Trac field Value
Version 6.12.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC vogt.adam@gmail.com
Operating system
Architecture
Edited by Ian Lynagh -
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information