extending GHC plugins with Hooks

Luite Stegeman stegeman at gmail.com
Thu Aug 22 22:07:13 CEST 2013


On Thu, Aug 22, 2013 at 6:13 PM, Simon Peyton-Jones
<simonpj at microsoft.com>wrote:

>  Luite, Edsko, Thomas, Nicolas****
>
> ** **
>
> You have all variously proposed improvements to the GHC API and/or the
> plug-in mechanism.  I have been so swamped in the last few months that I
> have not had a chance to look carefully at your proposals, nor how they
> relate to each other.****
>
> **
>

Edsko's source plugins are similar to Hooks, adding some functions to
customize things through DynFlags. Unfortunately, adding things to DynFlags
makes DynFlags depend on them, which severely limits extensibility of
source plugins (already evidenced by Edsko's implementation using (forall
m. MonadIO m => constraints for the plugins, instead of the actual RnM and
Hsc monads in which they're always run)

Hooks adds an indirection to avoid this. I've implemented Edsko's source
plugins patch in terms of hooks in the latest update.

I think the RunPhaseHook already does much of what Thomas needs, perhaps he
also needs something for hscParse / hscSimplify (both just a few lines
change).


luite

The plugins from Edsko's patch as hooks:
RunQuasiQuoterHook:
https://github.com/ghcjs/ghcjs-build/blob/f0147ed8b588151461557b0a8440581c4d36c9ec/refs/patches/ghc-ghcjs.patch#L1440
HscFrontendHook:
https://github.com/ghcjs/ghcjs-build/blob/f0147ed8b588151461557b0a8440581c4d36c9ec/refs/patches/ghc-ghcjs.patch#L740

How to use:
https://gist.github.com/luite/6312097
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20130822/fd9f4cb8/attachment.htm>


More information about the ghc-devs mailing list