GHC.Core.Opt.Arity

ghc-9.0.0.20200925: The GHC API

Safe Haskell | None
Language | Haskell2010

GHC.Core.Opt.Arity

Description

Arity and eta expansion

Synopsis

- manifestArity :: CoreExpr -> Arity
- joinRhsArity :: CoreExpr -> JoinArity
- exprArity :: CoreExpr -> Arity
- typeArity :: Type -> [OneShotInfo]
- exprEtaExpandArity :: DynFlags -> CoreExpr -> ArityType
- findRhsArity :: DynFlags -> Id -> CoreExpr -> Arity -> ArityType
- etaExpand :: Arity -> CoreExpr -> CoreExpr
- etaExpandAT :: ArityType -> CoreExpr -> CoreExpr
- etaExpandToJoinPoint :: JoinArity -> CoreExpr -> ([CoreBndr], CoreExpr)
- etaExpandToJoinPointRule :: JoinArity -> CoreRule -> CoreRule
- exprBotStrictness_maybe :: CoreExpr -> Maybe (Arity, StrictSig)
- data ArityType
  - = ATop [OneShotInfo]
  - | ABot Arity
- expandableArityType :: ArityType -> Bool
- arityTypeArity :: ArityType -> Arity
- maxWithArity :: ArityType -> Arity -> ArityType
- isBotArityType :: ArityType -> Bool
- idArityType :: Id -> ArityType

# 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 -> ArityType Source #

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

etaExpand :: Arity -> CoreExpr -> CoreExpr Source #

`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'

etaExpandAT :: ArityType -> CoreExpr -> CoreExpr Source #

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 #

data ArityType Source #

Constructors

ATop [OneShotInfo] |
ABot Arity |

#### Instances

Instances details

Eq ArityType # |
Instance details Defined in GHC.Core.Opt.Arity Methods (==) :: ArityType -> ArityType -> Bool # (/=) :: ArityType -> ArityType -> Bool #
Outputable ArityType # |
Instance details Defined in GHC.Core.Opt.Arity Methods ppr :: ArityType -> SDoc Source # pprPrec :: Rational -> ArityType -> SDoc Source #

expandableArityType :: ArityType -> Bool Source #

arityTypeArity :: ArityType -> Arity Source #

maxWithArity :: ArityType -> Arity -> ArityType Source #

isBotArityType :: ArityType -> Bool Source #

idArityType :: Id -> ArityType Source #