TH recompilation check is defeated by packages
It's possible to defeat the recompilation checker by using and then modifying a TH definition from another package.
Reproducer: https://github.com/mpickering/special-fiesta
In the example there are two packages. Package p
defines a library
module Lib where
{-# NOINLINE p #-}
p = [| 0 |]
which is then used in package q
:
module Main where
import Lib
main = print $(p)
Running the executable prints 0
initially.
Then modifying the library p
,
module Lib where
p = [| 1 |]
when the executable is rerun the result should be printing 1
, but it still prints 0
.
The recompilation check fails because the ABI for Lib
didn't change, and so GHC concluded that it didn't need to recompile Main
again.
The logic for computing stable modules only considers stability for home package modules when it should also consider whether the object files for dependencies have changed.
A correct fix is to take the hash of all the object files in the transitive dependencies of a module (such as is already done for plugins)