Skip to content

ghci gets confused if a file is deleted

With GHC 8.0 RC2 if a currently loaded .hs file is deleted then :reload works, but actual execution of anything is broken. In previous versions this situation resulted in an error at :reload time. Below is a session that demonstrate the bug:

$ ghci A.hs
GHCi, version 8.0.0.20160205: http://www.haskell.org/ghc/  :? for help
[1 of 2] Compiling B                ( B.hs, interpreted )
[2 of 2] Compiling A                ( A.hs, interpreted )
Ok, modules loaded: A, B.
*A> :!cat A.hs
module A where
import B
a = b + 1
*A> :!cat B.hs
module B where
b = 41
*A> :!mv B.hs B.txt
*A> :r
Ok, modules loaded: A.
*A> :show modules
A                ( A.hs, interpreted )
*A> a
<interactive>: fatal:
    cannot find object file for module `B'
    while linking an interpreted expression
*A> :r
Ok, modules loaded: A.

Specifically, I load A.hs, which depends on B.hs. I move B.hs away (or delete it). I reload and it says everything is fine. I try to run and it fails. Putting the B.hs file back solves it. This sequence worked fine in all previous versions of GHC, and is caught by the ghcid test suite.

Trac metadata
Trac field Value
Version 8.0.1-rc2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component GHCi
Test case
Differential revisions
BlockedBy
Related
Blocking
CC ndmitchell@gmail.com
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information