Add `-fskip-recomp-unstable-th` option. See #14769.
This is a workaround for "The [TH] Recompilation Problem" (see https://gist.github.com/nh2/14e653bcbdc7f40042da3755539e554a) that users can use when they know that their TH code does not reify *values* of variables from other modules in combination with incremental `ghc --make` invocations. This is especially the case for most simple uses of TemplateHaskell that only refer to things from the same module, such as generating lenses or serialisation formats. In such cases, using this flag is safe to use and can dramatically speed up ompilation by avoiding unnecessary cascading "[TH]" compilations as usually indicated in output like: $ touch A.hs && ghc --make Main.hs [1 of 3] Compiling A ( A.hs, A.o ) [2 of 3] Compiling B ( B.hs, B.o ) [TH] <- [TH] here [3 of 3] Compiling Main ( Main.hs, Main.o ) [TH] <- [TH] here The option `-fskip-recomp-unstable-th` is best used on a per-package basis, on packages that are known to only use simple TH as described above. Given GHC's current reocmpilation checks (see #14769), it has the same effect as cancelling and re-starting `ghc --make` after each successfully compiled Haskell module. In the future, we'd like to make this flag unnecessary, determining when it is safe to skip this check automatically. However, as discussed in #14769, this is significant work, so this flag is intended give users with large code bases using TH a way out of waiting for compilation until the problem is solved.
Loading