
Joachim Breitner
Hi,
Sorry for the late response; this was buried in my inbox.
we are all in agreement that we want plugins the ability to avoid recompilation. The open question is: Should this be on a per module basis? Or a per module-and-pass bases?
The former has a simpler and backward-compatible API, the latter sets the stage for some potential future where the compiler might typecheck a program, but then abort and not code generate.
… seriously, I still don’t see how that future can be. Can someone please give a concrete example of circumstances where that might happen?
Ben hints at sub-module granularity, but that slices it orthogonal to the current proposal. He also write
Lumping together all of the recompilation checks into a single hash would expose a relatively ugly facet of GHC's implementation to plugin authors and force authors to tie together logic from conceptually-distinct compilation phases.
but that is also not quite true. Note that the hash is not generated _during_ the passes, but needs to be calculated before. The type signature of the recalculation check, namely
pluginRecompile :: [CommandLineOption] -> IfG PluginRecompile
clearly indicates that this is a per-module check (otherwise, you’d see an ModGuts input, or such).
And even if, in the future, we have ability to provide a finer grained mechanism, we can add the necessary functions _then_ when we know how it looks.
Your argument is pretty compelling. I'll admit that part of my dislike of the the simple approach that you advocate is purely aesthetic; it just feels terribly ad-hoc. That being said, you do raise a valid point that we really don't know enough to be able to say what a more precise interface would look like. Moreover, there is something to be said for the nice backwards-compatibility story that the simple approach allows. I would be fine accepting the simple approach. Either way, I think we should move this proposal forward to unblock our contributor. Cheers, - Ben