Typechecker plugins: request for review and another workflow question

Adam Gundry adam at well-typed.com
Mon Nov 10 17:46:20 UTC 2014


On 10/11/14 15:58, Austin Seipp wrote:
>  - 2) I am kind of not a fan of having separate 'plugins for
> core2core' and 'plugins for typechecking' flags, AKA -ftc-plugin and
> -fplugin. Ideally I would think all plugins could be uniformly
> specified by simply saying '-fplugin'. This mostly avoids the need for
> duplication and a naming convention/slew of flags for each case (which
> we have to catalog and document). There may be an easy way to make
> this the case; I haven't looked closely yet (it has been some time
> since I starred at the plugin code, even though Max wrote it and I
> helped get it merged!)

FWIW, I originally envisaged reusing the existing plugins machinery, and
I don't think there are any great problems in doing so (see
https://ghc.haskell.org/trac/ghc/wiki/Plugins/TypeChecker). In fact, I
had an early implementation of typechecker plugins that did exactly this.

I have been wondering, however, about another possible approach. We could:

 1. make the constraint solver changes use a *hook*, instead of the
plugins directly, and

 2. make it possible for plugins to install/modify hooks at some
suitable point in the compilation pipeline.

I don't know the hooks machinery very well, but if this is feasible it
seems like it would provide more power (plugins could modify any part of
GHC for which a hook is available) and avoid having multiple overlapping
ways of extending GHC. In the future, I can imagine wanting plugins to
hook into other parts of GHC (e.g. error message postprocessing for
domain-specific error reporting), and this seems like a good way to
achieve that.

Adam


> On Sun, Nov 9, 2014 at 6:17 PM, Iavor Diatchki <iavor.diatchki at gmail.com> wrote:
>> Hello,
>>
>> I just finished merging HEAD into the branch implementing constraint solver
>> plugins (`wip/tc-plugins`), so things should be fully up to date.  For ease
>> of review, I squashed everything into a single commit:
>>
>> https://github.com/ghc/ghc/commit/31729d092c813edc4ef5682db2ee18b33aea6911
>>
>> could interested folks (I know of SimonPJ, Richard, and Adam) have a look
>> and let me know if things look reasonable?
>>
>> On a related note:  I know that we are using phabricator for code review,
>> but I don't know how to use it yet, so please let me know if I can do
>> something to make the review easier.
>>
>> -Iavor


-- 
Adam Gundry, Haskell Consultant
Well-Typed LLP, http://www.well-typed.com/


More information about the ghc-devs mailing list