Skip to content

-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

  1. Make a haskell file, test.hs, containing at least main = pure ().

  2. Run ghci -fexternal-interpreter -fobject-code test.hs.

  3. In ghci, run :main. Observe that nothing is output.

  4. Edit the file to change main to e.g. main = putStrLn "hello, world".

  5. Reload (:r). Observe that it recompiles the object file.

  6. 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
Edited by Ömer Sinan Ağacan
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information