ghc --make should not relink when we know the binary doesn't change
I would expect GHC not to relink after touching a file, since no actual program code was changed. But it does:
$ echo "main = return ()" > Main.hs
$ ghc --make Main.hs
[1 of 1] Compiling Main ( Main.hs, Main.o )
Linking Main ...
$ touch Main.hs
$ ghc --make Main.hs
[1 of 1] Compiling Main ( Main.hs, Main.o )
Linking Main ...
I would expect that the recompilation avoidance makes GHC stop continuing as soon as it has noticed that the same object code (.o
file) was generated as in the first build.
Perhaps even earlier (e.g. after parsing) in this specific case; but certainly after code gen, which I'd expect also to avoid the recompilation if e.g. a comment was added to the file, as the comment won't make it into the program code (unless something like TH location
or HasCallStack
is used, which can change the line numbers those generate if a comment pushes them down).