Adding rules in a plugin?

Conal Elliott conal at
Wed Feb 10 18:17:04 UTC 2016

More study of GHC source code answered my question: when I generate a rule,
set ru_auto to False rather than True, so that findExternalRules won't
delete the rule.

On Tue, Feb 9, 2016 at 6:47 PM, Conal Elliott <conal at> wrote:

> I'm writing a GHC plugin that generates new rules. The top-level
> identifier for the new rules' LHSs is always the same and is imported from
> another module. One of the arguments in the rule's LHSs, however, is
> defined in that module. I'm creating rules and adding them to the mg_rules
> of the module's ModGuts. I don't see them in the .hi files (viewed with
> "ghc --show-iface Foo.hi"), and they're not getting found in modules that
> import the modules where I'm trying to generate rules. Am I missing a
> crucial step? For instance, do I need also to use `addIdSpecialisations`
> with the argument identifiers, and if so, need I replace all instances of
> those identifiers in the module or just some of them?
> Thanks, -- Conal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the ghc-devs mailing list