The main rule matching function. Attempts to apply all (active) supplied rules to this instance of an application in a given context, returning the rule applied and the resulting expression if successful.
Moduleghc-9.10.3GHC2021
GHC.Core.Rules
Functions for collecting together and applying rewrite rules to a module. The CoreRule datatype itself is declared elsewhere.
- 2 types
- 22 values
- Packageghc-9.10.3
- Exports24
- LanguageGHC2021
- LicenceBSD-3-Clause
- SourceRules.hs
Looking up rules
RuleBase, RuleEnv
A full rule environment which we can apply rules from. Like a RuleBase, but it also includes the set of visible orphans we use to filter out orphan rules which are not visible (even though we can see them...) See Note [Orphans] in GHC.Core
Constructors
Checking rule applications
ruleCheckProgram :: RuleOptsRule options
-> CompilerPhaseRule activation test
-> StringRule pattern
-> (Id -> [CoreRule])Rules for an Id
-> CoreProgramBindings to check in
-> SDocResulting check message
Report partial matches for rules beginning with the specified string for the purposes of error reporting
Manipulating RuleInfo rules
RuleBase and RuleEnv
Misc. CoreRule helpers
3 declarationsGather all the rules for locally bound identifiers from the supplied bindings
Making rules
3 declarationsFind the "top" free names of several expressions. Such names are either:
The function finally being applied to in an application chain (if that name is a GlobalId: see
GHC.Types.Var#globalvslocal), orThe
TyConif the expression is a Type
This is used for the fast-match-check for rules; if the top names don't match, the rest can't