-
Notifications
You must be signed in to change notification settings - Fork 726
Closed
Labels
Description
One of the primary benefits of hi-haddock is the ability to reuse existing build results (.hi and .hie files) to generate documentation, avoiding recompilation. However, Cabal does some things that make this difficult to achieve:
- Passes
-stubdir=<temp directory>to GHC through Haddock. This immediately invalidates any previous build results since the-stubdirflag is included in the dynflags fingerprint (see this GHC ticket). - Passes
-optP-D__HADDOCK_VERSION__=...to GHC through Haddock on every invocation. This also triggers recompilation unless previous results were also built with the same macro definition.
I don't think Cabal needs to worry about setting -hidir, -stubdir, and -odir to temp directories, since Haddock will not (by default) overwrite these files anymore.
I also think there should be a flag that allows users to request no __HADDOCK_VERSION__ macro be defined, since this is a rarely used feature (it occurs in only 19 packages on Hackage) and it greatly hinders recompilation avoidance.