CoreArity

ghc-8.0.0.20160204: The GHC API

Safe Haskell | None
Language | Haskell2010

CoreArity

Description

Arity and eta expansion

Synopsis

- manifestArity :: CoreExpr -> Arity
- exprArity :: CoreExpr -> Arity
- typeArity :: Type -> [OneShotInfo]
- exprBotStrictness_maybe :: CoreExpr -> Maybe (Arity, StrictSig)
- exprEtaExpandArity :: DynFlags -> CoreExpr -> Arity
- findRhsArity :: DynFlags -> Id -> CoreExpr -> Arity -> Arity
- type CheapFun = CoreExpr -> Maybe Type -> Bool
- etaExpand :: Arity -> CoreExpr -> CoreExpr

# Documentation

manifestArity :: CoreExpr -> Arity Source

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

exprArity :: CoreExpr -> Arity Source

An approximate, fast, version of `exprEtaExpandArity`

typeArity :: Type -> [OneShotInfo] Source

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

exprEtaExpandArity :: DynFlags -> CoreExpr -> Arity Source

findRhsArity :: DynFlags -> Id -> CoreExpr -> Arity -> Arity Source

The Arity returned is the number of value args the expression can be applied to without doing much work

type CheapFun = CoreExpr -> Maybe Type -> Bool Source

etaExpand Source

Arguments

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

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

Given:

    e' = etaExpand n us e ty

We should have that:

    ty = exprType e = exprType e'