Skip to content

GHCi ignores :set -fbyte-code command

Summary

When GHCi is started with -fobject-code, it ignores a :set -fbyte-code command.

Steps to reproduce

Take any Haskell module eg Foo.hs:

main :: IO ()
main = putStrLn "Hello World"

Then set to byte-codeand load the module:

$ ghc --interactive -fobject-code
GHCi, version 8.10.1: https://www.haskell.org/ghc/  :? for help
Prelude> :set -fbyte-code 
Prelude> :l Foo.hs
[1 of 1] Compiling Main             ( Foo.hs, Foo.o )
Ok, one module loaded.

The module is compiled to object code (Foo.o)

Expected behavior

The module should be compiled to interpreted byte-code as in GHC 8.8.4:

$ ghc --interactive -fobject-code
GHCi, version 8.8.4: https://www.haskell.org/ghc/  :? for help
Prelude> :set -fbyte-code 
Prelude> :l Foo.hs
[1 of 1] Compiling Main             ( Foo.hs, interpreted )
Ok, one module loaded.

Environment

  • GHC versions 8.10.1, 8.10.2 and HEAD contain the bug
  • GHC versions below eg 8.8.4, 8.8.3 etc work as expected

Optional:

  • Operating System: Debian 10
  • System Architecture: x86_64
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information