Confusing order of plugin installation
Summary
This is perhaps at least improvable in code, but I'm suggesting it as a documentation issue to describe the current behavior.
Location of documentation issue: the GHC user's guide,
The installation order of plugins is confusing and undocumented as near as I can tell. If you pass -fplugin=Foo -fplugin=Bar
to GHC, Bar
gets installed first, followed by Foo
, when I would expect the opposite. I discovered this when I created an intentionally malicious plugin to try to strengthen a plugin I was working on. The behavior of the two together was the reverse of what I expected in each case.
Proposed improvements or changes
In DynFlags, each subsequent plugin flag that is found is added to the front of the plugin list. Either building the list in reverse or reversing the list when installing the plugins would make it more intuitive.
However, for the time being, it'd be helpful if the GHC user's guide at least described the current behavior ... and also indicated when plugins installed via addCorePlugin
get installed. It seems like the -fplugin
documentation would be a good place to add this.
Environment
- GHC version used (if appropriate): 8.8.1