Skip to content

Unexported bindings can't be used on reload in GHCi when using `-fbyte-code -fprefer-byte-code -fwrite-interface -fbyte-code-and-object-code`

-- A.hs
module A () where

double :: Int -> Int
double x = x + x
❯ ghci-9.6 A.hs -fbyte-code -fprefer-byte-code -fwrite-interface -fbyte-code-and-object-code
GHCi, version 9.6.3: https://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/zubin/dotfiles/.ghci
[1 of 1] Compiling A                ( A.hs, interpreted )
Ok, one module loaded.
λ> double 3
6
it :: Int
λ> 
Leaving GHCi.

This is fine, but running it again doesn't work

❯ ghci-9.6 A.hs -fbyte-code -fprefer-byte-code -fwrite-interface -fbyte-code-and-object-code
GHCi, version 9.6.3: https://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/zubin/dotfiles/.ghci
Ok, one module loaded.
λ> double 3
<interactive>:1:1: error: [GHC-88464]
    Variable not in scope: double :: t0 -> t

They are present in extra_decls field of the Iface.

Edited by Zubin
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information