Enable plugins to access comments
Since the source plugin system was implemented it is possible to extend the functionality of GHC without using it as a library, keeping the original behavior of the compiler and extending it.
Some tools using this approach would profit from accessing the comments of the program. However, comments are only kept when the Opt_KeepRawTokenStream
is set before parsing begins. I found no way of setting this with the current plugin system.
My suggested solution is to create a plugin action that can run before compiling each module. It is a general solution that can solve future problems by configuring the compiler before a module is compiled.
This would extend the Plugin type with a field
configureAction :: [CommandLineOption] -> ModSummary -> Ghc ()