This patch relates to Trac Trac #8025
The goal here is to enable typechecking of packages that contain some
template haskell. Prior to this patch, compilation of a package with -fno-code
would fail if any functions in the package were called from within a splice.
downsweep is changed to do an additional pass over the modules, targetting
any ModSummaries transitively depended on by a module that has
LangExt.TemplateHaskell enabled. Those targeted modules have hscTarget changed
from HscNothing to the default target of the platform.
There is a small change to the prevailing_target logic to enable this.
A simple test is added.
I have benchmarked with and without a patched haddock (available:https://github.com/duog/haddock/tree/wip-no-explicit-th-compilation).
Running cabal haddock on the wreq package results in a 25% speedup on my machine:
time output from patched cabal haddock:
time output from unpatched cabal haddock: