Source plugins should be able to opt-out from appearing in dependencies
Currently when ghc build a module M using a source plugin in a package P, P shows up in the interface file of M (M.hi
).
According to --show-iface
, P shows up in the package dependencies
section, and in an addDependentFile
entry.
Presumably, this is necessary to recompile M if P ever changes. But unfortunately, including P in the interface file is the wrong thing to do when the plugin does not affect the result of the compilation of M.
It is only fair to wonder what the point would be in using a plugin which does not modify the compilation. I hit this case when using the upcoming haskell-indexer-plugin, which extracts source code information for later examination.
If the indexer plugin changes, there is no point in rebuilding M, unless the user really wants to reindex the source code. As things stand, ghc
wants to know where the plugin is every time it is mentioned in the dependencies of a module which is being linked, even though the plugin won't be used for anything. This sometimes can make the plugin harder to use in a large project.
Can we change the plugin interface to opt-out of tracking dependencies? Or would it work better to provide a ghc flag to control this?