Note [Unfold compulsory unfoldings in RULE LHSs]
When the user writes `RULES map coerce = coerce` as a rule, the rule will only ever match if simpleOptExpr replaces coerce by its unfolding on the LHS, because that is the core that the rule matching engine will find. So do that for everything that has a compulsory unfolding. Also see Note [Desugaring coerce as cast] in GHC.HsToCore. However, we don't want to inline 'seq', which happens to also have a compulsory unfolding, so we only do this unfolding only for things that are always-active. See Note [User-defined RULES for seq] in GHC.Types.Id.Make.
References 2
- Desugaring coerce as cast GHC.HsToCore
- User-defined RULES for seq GHC.Types.Id.Make
Referenced by 1
- GHC.Core.SimpleOpt call site