-lookupRule :: (Activation -> Bool) -> InScopeSet
- -> RuleBase -- Imported rules
- -> Id -> [CoreExpr] -> Maybe (CoreRule, CoreExpr)
+-- | The main rule matching function. Attempts to apply all the active
+-- rules in a given 'RuleBase' to this instance of an application
+-- in a given context, returning the rule applied and the resulting
+-- expression if successful.
+lookupRule :: (Activation -> Bool) -- ^ Activation test
+ -> InScopeSet -- ^ Variables that are in scope at this point
+ -> RuleBase -- ^ Imported rules
+ -> Id -- ^ Function 'Id' to lookup a rule by
+ -> [CoreExpr] -- ^ Arguments to function
+ -> Maybe (CoreRule, CoreExpr)