Implement "An API for deciding whether plugins should cause recompilation"
authorMatthew Pickering <matthew.pickering@tweag.io>
Sun, 27 May 2018 15:57:27 +0000 (11:57 -0400)
committerBen Gamari <ben@smart-cactus.org>
Wed, 30 May 2018 22:06:33 +0000 (18:06 -0400)
commit1d1e2b77fdc2babdf4fff72b9120c6831e7b422f
tree088af3cf628ef34181ec90434d55d5f1b05ead41
parente0b44e2eccd4053852b6c4c3de75a714301ec080
Implement "An API for deciding whether plugins should cause recompilation"

This patch implements the API proposed as pull request #108 for plugin
authors to influence the recompilation checker.

It adds a new field to a plugin which computes a `FingerPrint`. This is
recorded in interface files and if it changes then we recompile the
module. There are also helper functions such as `purePlugin` and
`impurePlugin` for constructing plugins which have simple recompilation
semantics but in general, an author can compute a hash as they wish.

Fixes #12567 and #7414

https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/002
2-plugin-recompilation.rst

Reviewers: bgamari, ggreif

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #7414, #12567

Differential Revision: https://phabricator.haskell.org/D4366
29 files changed:
compiler/deSugar/Desugar.hs
compiler/deSugar/DsUsage.hs
compiler/iface/LoadIface.hs
compiler/iface/MkIface.hs
compiler/main/DynamicLoading.hs
compiler/main/HscTypes.hs
compiler/main/Plugins.hs
compiler/simplCore/CoreMonad.hs
compiler/simplCore/SimplCore.hs
docs/users_guide/extending_ghc.rst
testsuite/tests/plugins/Makefile
testsuite/tests/plugins/T12567a.stderr
testsuite/tests/plugins/all.T
testsuite/tests/plugins/plugin-recomp-flags.stderr [new file with mode: 0644]
testsuite/tests/plugins/plugin-recomp-flags.stdout [new file with mode: 0644]
testsuite/tests/plugins/plugin-recomp-impure.stderr [new file with mode: 0644]
testsuite/tests/plugins/plugin-recomp-impure.stdout [new file with mode: 0644]
testsuite/tests/plugins/plugin-recomp-pure.stderr [new file with mode: 0644]
testsuite/tests/plugins/plugin-recomp-pure.stdout [new file with mode: 0644]
testsuite/tests/plugins/plugin-recomp-test.hs [new file with mode: 0644]
testsuite/tests/plugins/plugin-recomp/Common.hs [new file with mode: 0644]
testsuite/tests/plugins/plugin-recomp/FingerprintPlugin.hs [new file with mode: 0644]
testsuite/tests/plugins/plugin-recomp/ImpurePlugin.hs [new file with mode: 0644]
testsuite/tests/plugins/plugin-recomp/LICENSE [new file with mode: 0644]
testsuite/tests/plugins/plugin-recomp/Makefile [new file with mode: 0644]
testsuite/tests/plugins/plugin-recomp/PurePlugin.hs [new file with mode: 0644]
testsuite/tests/plugins/plugin-recomp/Setup.hs [new file with mode: 0644]
testsuite/tests/plugins/plugin-recomp/plugin-recomp.cabal [new file with mode: 0644]
testsuite/tests/plugins/simple-plugin/Simple/Plugin.hs