TH: --make does not detect changes in imported functions used in a
splice
Duncan Coutts
duncan.coutts at worcester.oxford.ac.uk
Wed May 26 14:12:53 EDT 2004
Suppose we have
ModuleA.hs (and .o)
exports funcA :: Something -> ExpQ
ModuleB.hs (and .o)
has definition
funcB = $(funcA something)
Now if we edit the implementation (but not the signature) of funcA in
ModuleA.hs and run
$ ghc -fth --make ModuleB
then ModuleA is recomplied but ModuleB is not. However on deleting
ModuleB.o and issuing the same command
$ ghc -fth --make ModuleB
then ModuleB is recompiled as expected but now we discover the mistake
we made when editing funcA which manifests itself as a semantic/type
error or some such in the code generated by funcA. The point being, that
this error was not detected the first time we recompiled because the
dependency of funcB on funcA's implementation was not considered.
The problem of course is that using imported template programs depend on
their implementation not just their signature because we use the
imported template programs to generate code in the current module which
can fail at compile time.
I don't know enough about ghc's .hi files to know if there's an easy fix
to this or not. My understanding is that .hi files contain a revision
stamp on the interface description of functions (and other stuff like
strictness etc) and modules get recompiled if any interfaces they use
have changed. Perhaps it would be possible to add an implementation
revision stamp too and modules would be recompiled if there has been an
implementation change of any imported function used withing a splice.
This might be too much pain for little gain.
Duncan
More information about the Glasgow-haskell-bugs
mailing list