-fno-code, TemplateHaskell, ghci, leads to panic
If you load a module using -fno-code then try to use an identifier from that module in a splice then it leads to an internal error.
module E where
a = id
:set -XTemplateHaskell
$(a [| () |])
ghci E.hs -fno-code < ghci.script
ghc: ^^ Could not load 'E_a_closure', dependency unresolved. See top entry above.
ByteCodeLink.lookupCE
During interactive linking, GHCi couldn't find the following symbol:
E_a_closure
This may be due to you not asking GHCi to load extra object files,
archives or DLLs needed by your current session. Restart GHCi, specifying
the missing library using the -L/path/to/object/dir and -lmissinglibname
flags, or simply by naming the relevant files on the GHCi command line.
Alternatively, this link failure might indicate a bug in GHCi.
If you suspect the latter, please report this as a GHC bug:
https://www.haskell.org/ghc/reportabug
Clearly the use of a
in a splice should be forbidden as there is no code available to execute the splice.
We can fix this issue nicely when splice imports is implemented, in fact, that's how I noticed this was broken.