-fexternal-interpreter does not load recompiled code with -fobject-code
Summary
When running ghci
with both -fexternal-interpreter
and -fobject-code
, changes are recompiled, but the recompiled object files are not loaded.
Steps to reproduce
-
Make a haskell file,
test.hs
, containing at leastmain = pure ()
. -
Run
ghci -fexternal-interpreter -fobject-code test.hs
. -
In
ghci
, run:main
. Observe that nothing is output. -
Edit the file to change main to e.g.
main = putStrLn "hello, world"
. -
Reload (
:r
). Observe that it recompiles the object file. -
Run
:main
. Observe that nothing is output.
Expected behavior
It should have run the new code. This scales up to more complex examples; it is specifically running the previously-compiled code. This can be explored further by switching between -fobject-code
and -fbyte-code
in ghci
on the fly while touching source files; only after touching the module, reloading with -fbyte-code
to generate bytecode, running, touching the module again, and reloading with -fobject-code
will it start picking up the changes.
Environment
- GHC version used: 8.8.1
Optional:
- Operating System: macOS 10.15.2
- System Architecture: x86-64