CoreArity

ghc-8.10.0.20191123: The GHC API

Safe Haskell | None
Language | Haskell2010

CoreArity

Description

Arity and eta expansion

Synopsis

- manifestArity :: CoreExpr -> Arity
- joinRhsArity :: CoreExpr -> JoinArity
- exprArity :: CoreExpr -> Arity
- typeArity :: Type -> [OneShotInfo]
- exprEtaExpandArity :: DynFlags -> CoreExpr -> Arity
- findRhsArity :: DynFlags -> Id -> CoreExpr -> Arity -> (Arity, Bool)
- etaExpand :: Arity -> CoreExpr -> CoreExpr
- etaExpandToJoinPoint :: JoinArity -> CoreExpr -> ([CoreBndr], CoreExpr)
- etaExpandToJoinPointRule :: JoinArity -> CoreRule -> CoreRule
- exprBotStrictness_maybe :: CoreExpr -> Maybe (Arity, StrictSig)

# Documentation

manifestArity :: CoreExpr -> Arity Source #

manifestArity sees how many leading value lambdas there are, after looking through casts

joinRhsArity :: CoreExpr -> JoinArity Source #

exprArity :: CoreExpr -> Arity Source #

An approximate, fast, version of `exprEtaExpandArity`

typeArity :: Type -> [OneShotInfo] Source #

exprEtaExpandArity :: DynFlags -> CoreExpr -> Arity Source #

findRhsArity :: DynFlags -> Id -> CoreExpr -> Arity -> (Arity, Bool) Source #

etaExpand Source #

Arguments

:: Arity | Result should have this number of value args
-> CoreExpr | Expression to expand
-> CoreExpr |

`etaExpand n e` returns an expression with the same meaning as `e`, but with arity `n`.

Given:

    e' = etaExpand n e

We should have that:

    ty = exprType e = exprType e'

etaExpandToJoinPoint :: JoinArity -> CoreExpr -> ([CoreBndr], CoreExpr) Source #

Split an expression into the given number of binders and a body, eta-expanding if necessary. Counts value *and* type binders.

etaExpandToJoinPointRule :: JoinArity -> CoreRule -> CoreRule Source #

exprBotStrictness_maybe :: CoreExpr -> Maybe (Arity, StrictSig) Source #