ghci doesn't always use compiled modules
Here is a small program:
module T where
foo :: Int -> Int
foo n = n+1
module U where
import T
main = print (foo 1)
Now I do this:
$ ghc -c T.hs
$ runhaskell -v U.hs
...
[1 of 2] Skipping T ( T.hs, T.o )
...
$ touch T.hs
$ runhaskell -v U.hs
...
[1 of 2] Compiling T ( T.hs, interpreted )
...
$ ghc -c T.hs -fforce-recomp
$ runhaskell -v U.hs
...
[1 of 2] Compiling T ( T.hs, interpreted )
...
Note that runhaskell
doesn't use T.o
even though I recompiled T
. As far as I understand, this is because compilation has regenerated T.o
but hasn't updated T.hi
because the interface hasn't changed. So T.hi
is older than T.hs
and ghci
seems to ignore the compiled version in this case. I'm not sure why the .hi
file's timestamped is checked here, it seems that checking the .o
file should be sufficient.
Trac metadata
Trac field | Value |
---|---|
Version | 7.2.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |