GHC.Core.Opt.ConstantFold

ghc-lib-parser-9.10.1.20250103: The GHC API, decoupled from GHC versions

Safe Haskell | Ignore
Language | GHC2021

GHC.Core.Opt.ConstantFold

Description

Constant Folder

Synopsis

- primOpRules :: Name -> PrimOp -> Maybe CoreRule
- builtinRules :: [CoreRule]
- caseRules :: Platform -> CoreExpr -> Maybe (CoreExpr, AltCon -> Maybe AltCon, Id -> CoreExpr)
- caseRules2 :: InExpr -> InId -> [InAlt] -> Maybe (InExpr, InId, [InAlt])

# Documentation

primOpRules :: Name -> PrimOp -> Maybe CoreRule #

builtinRules :: [CoreRule] #

caseRules :: Platform -> CoreExpr -> Maybe (CoreExpr, AltCon -> Maybe AltCon, Id -> CoreExpr) #

Match the scrutinee of a case and potentially return a new scrutinee and a function to apply to each literal alternative.

caseRules2 #

Arguments

:: InExpr | Scutinee
-> InId | Case-binder
-> [InAlt] | Alternatives in standard (increasing) order
-> Maybe (InExpr, InId, [InAlt]) |

Case rules

It's important that occurrence info are present, hence the use of In* types.