Skip to content

Quoting an internal variable causes an error when splicing

{-# LANGUAGE TemplateHaskell #-}
module A where

import B

main = $$f
{-# LANGUAGE TemplateHaskell #-}
module B(f) where

d = 0

f = [|| d ||]

Note that d is not exported from B.

[1 of 2] Compiling B                ( B.hs, B.o )
[2 of 2] Compiling A                ( A.hs, A.o )

A.hs:6:8: error:
    • Can't find interface-file declaration for variable B.d
        Probable cause: bug in .hi-boot file, or inconsistent .hi file
        Use -ddump-if-trace to get an idea of which file caused the error
    • In the expression: B.d
      In the result of the splice:
        $f
      To see what the splice expanded to, use -ddump-splices
      In the Template Haskell splice $$f
  |
6 | main = $$f
| ^^^

This doesn't seem to happen for untyped quotes/splices.

Trac metadata
Trac field Value
Version 8.6.1
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