GHCI always reloads hs-boot file
Summary
ghci :reload seems to always reload .hs-boot files even if they had no changes since last reload
Steps to reproduce
Looks like it is reproducible with any setup containing hs-boot files. Open ghci, load a file with :load, then :reload and see that hs boots are reloaded.
Here is a simple reproducer with ghc 9.4.4:
file Bar.hs:
module Bar where
import Foo
file Bar.hs-boot:
module Bar where
file Foo.hs:
module Foo where
import {-# SOURCE #-} Bar
Start ghci and run :load followed by multiples :reload:
GHCi, version 9.4.4: https://www.haskell.org/ghc/ :? for help
ghci> :l Bar.hs
[1 of 3] Compiling Bar[boot] ( Bar.hs-boot, interpreted )
[2 of 3] Compiling Foo ( Foo.hs, interpreted )
[3 of 3] Compiling Bar ( Bar.hs, interpreted )
Ok, three modules loaded.
ghci> :reload
[1 of 3] Compiling Bar[boot] ( Bar.hs-boot, interpreted ) [Missing object file]
Ok, three modules loaded.
ghci> :reload
[1 of 3] Compiling Bar[boot] ( Bar.hs-boot, interpreted ) [Missing object file]
Ok, three modules loaded.
ghci> :reload
[1 of 3] Compiling Bar[boot] ( Bar.hs-boot, interpreted ) [Missing object file]
Ok, three modules loaded.
Everytime the Bar.hs-boot file seems to be reloaded with the Missing object file reason.
Expected behavior
It should not reload if the file did not change, looks like wasted time. I suspect that some long reload time I'm observing with haskell-language-server may be caused by this.
Environment
- GHC version used: GHC 9.4.4.
Note that GHC 9.2.4 does not seem impacted, or at least, it does not show the debug messages:
GHCi, version 9.2.4: https://www.haskell.org/ghc/ :? for help
ghci> :l Bar.hs
[1 of 3] Compiling Bar[boot] ( Bar.hs-boot, interpreted )
[2 of 3] Compiling Foo ( Foo.hs, interpreted )
[3 of 3] Compiling Bar ( Bar.hs, interpreted )
Ok, three modules loaded.
ghci> :r
Ok, three modules loaded.
Optional:
- Operating System:
- System Architecture: