Implement TH addCorePlugin.
ClosedPublic

Authored by facundominguez on Aug 4 2017, 2:59 PM.

Details

Summary

This allows template-haskell code to add plugins to the compilation
pipeline. Otherwise, the user would have to pass -fplugin=... to ghc.

For now, plugin modules in the current package can't be used. This is
because when TH runs, it is too late to let GHC know that the plugin
modules needed to be compiled first.

Test Plan

./validate

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
facundominguez created this revision.Aug 4 2017, 2:59 PM
bgamari requested changes to this revision.Aug 18 2017, 7:51 AM

Looks fairly reasonable to me.

Can you add a mention of this in the plugins section of the users guide?

libraries/template-haskell/Language/Haskell/TH/Syntax.hs
490

Do you get a reasonable error message if the plugin belongs to the current package?

This revision now requires changes to proceed.Aug 18 2017, 7:51 AM
facundominguez added inline comments.Aug 18 2017, 9:16 AM
libraries/template-haskell/Language/Haskell/TH/Syntax.hs
490

The implementation of qAddCorePlugin raises

addCorePlugin: invalid plugin module <module>
Plugins in the current package can't be specified.
facundominguez edited edge metadata.
  • Mention addCorePlugin in the user guide.
bgamari accepted this revision.Sep 21 2017, 4:21 PM

Looks good to me.

This revision is now accepted and ready to land.Sep 21 2017, 4:21 PM
This revision was automatically updated to reflect the committed changes.