Skip to content

GHC-as-a-library does too much recompilation when given recursive module imports

In http://www.haskell.org/pipermail/glasgow-haskell-users/2006-October/011219.html (the archives seem to have lost the actual body text unfortunately) Brian Smith reports that the GHC API seems to do too much recompilation when used on the GHC sources. It looks like recursive module imports are the cause, as shown by the attached files. The session below shows 3 recompilations of A that should not be necessary; I'm not sure if we can also avoid the need to look at the hs-boot files again (perhaps by making a .hi-boot purely for timestamping purposes?).

$ rm *.o *.hi                         
$ ghc -package ghc foo.hs -o foo -Wall
$ ./foo 
[1 of 4] Compiling C[boot]          ( C.hs-boot, nothing )
[2 of 4] Compiling B                ( B.hs, B.o )

B.hs:6:0: Warning: Definition but no type signature for `b'
[3 of 4] Compiling A                ( A.hs, A.o )

A.hs:6:0: Warning: Definition but no type signature for `a'
[4 of 4] Compiling C                ( C.hs, C.o )

C.hs:6:0: Warning: Definition but no type signature for `c'

Succeeded!

[1 of 4] Compiling C[boot]          ( C.hs-boot, nothing )
[3 of 4] Compiling A                ( A.hs, A.o )

A.hs:6:0: Warning: Definition but no type signature for `a'

Succeeded!

[1 of 4] Compiling C[boot]          ( C.hs-boot, nothing )

Succeeded!

[1 of 4] Compiling C[boot]          ( C.hs-boot, nothing )

Succeeded!

$ ./foo
[1 of 4] Compiling C[boot]          ( C.hs-boot, nothing )
[3 of 4] Compiling A                ( A.hs, A.o )

A.hs:6:0: Warning: Definition but no type signature for `a'

Succeeded!

[1 of 4] Compiling C[boot]          ( C.hs-boot, nothing )
[3 of 4] Compiling A                ( A.hs, A.o )

A.hs:6:0: Warning: Definition but no type signature for `a'

Succeeded!

[1 of 4] Compiling C[boot]          ( C.hs-boot, nothing )

Succeeded!

[1 of 4] Compiling C[boot]          ( C.hs-boot, nothing )

Succeeded!
$ 
Trac metadata
Trac field Value
Version 6.6
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Unknown
Architecture Unknown
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information