Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data StrDmd
- data UseDmd
- data Count
- type Demand = JointDmd ArgStr ArgUse
- type DmdShell = JointDmd (Str ()) (Use ())
- type CleanDemand = JointDmd StrDmd UseDmd
- getStrDmd :: JointDmd s u -> s
- getUseDmd :: JointDmd s u -> u
- mkProdDmd :: [Demand] -> CleanDemand
- mkOnceUsedDmd :: CleanDemand -> Demand
- mkManyUsedDmd :: CleanDemand -> Demand
- mkHeadStrict :: CleanDemand -> CleanDemand
- oneifyDmd :: JointDmd s (Use u) -> JointDmd s (Use u)
- toCleanDmd :: Demand -> (DmdShell, CleanDemand)
- absDmd :: Demand
- topDmd :: Demand
- botDmd :: Demand
- seqDmd :: Demand
- lubDmd :: Demand -> Demand -> Demand
- bothDmd :: Demand -> Demand -> Demand
- lazyApply1Dmd :: Demand
- lazyApply2Dmd :: Demand
- strictApply1Dmd :: Demand
- isTopDmd :: Demand -> Bool
- isAbsDmd :: JointDmd (Str s) (Use u) -> Bool
- isSeqDmd :: Demand -> Bool
- peelUseCall :: UseDmd -> Maybe (Count, UseDmd)
- cleanUseDmd_maybe :: Demand -> Maybe UseDmd
- strictenDmd :: Demand -> CleanDemand
- bothCleanDmd :: CleanDemand -> CleanDemand -> CleanDemand
- addCaseBndrDmd :: Demand -> [Demand] -> [Demand]
- data DmdType = DmdType DmdEnv [Demand] DmdResult
- dmdTypeDepth :: DmdType -> Arity
- lubDmdType :: DmdType -> DmdType -> DmdType
- bothDmdType :: DmdType -> BothDmdArg -> DmdType
- nopDmdType :: DmdType
- botDmdType :: DmdType
- mkDmdType :: DmdEnv -> [Demand] -> DmdResult -> DmdType
- addDemand :: Demand -> DmdType -> DmdType
- ensureArgs :: Arity -> DmdType -> DmdType
- type BothDmdArg = (DmdEnv, Termination ())
- mkBothDmdArg :: DmdEnv -> BothDmdArg
- toBothDmdArg :: DmdType -> BothDmdArg
- type DmdEnv = VarEnv Demand
- emptyDmdEnv :: VarEnv Demand
- peelFV :: DmdType -> Var -> (DmdType, Demand)
- findIdDemand :: DmdType -> Var -> Demand
- type DmdResult = Termination CPRResult
- data CPRResult
- isBotRes :: DmdResult -> Bool
- isTopRes :: DmdResult -> Bool
- topRes :: DmdResult
- botRes :: DmdResult
- cprProdRes :: [DmdType] -> DmdResult
- vanillaCprProdRes :: Arity -> DmdResult
- cprSumRes :: ConTag -> DmdResult
- appIsBottom :: StrictSig -> Int -> Bool
- isBottomingSig :: StrictSig -> Bool
- pprIfaceStrictSig :: StrictSig -> SDoc
- trimCPRInfo :: Bool -> Bool -> DmdResult -> DmdResult
- returnsCPR_maybe :: DmdResult -> Maybe ConTag
- newtype StrictSig = StrictSig DmdType
- mkStrictSigForArity :: Arity -> DmdType -> StrictSig
- mkClosedStrictSig :: [Demand] -> DmdResult -> StrictSig
- nopSig :: StrictSig
- botSig :: StrictSig
- cprProdSig :: Arity -> StrictSig
- isTopSig :: StrictSig -> Bool
- hasDemandEnvSig :: StrictSig -> Bool
- splitStrictSig :: StrictSig -> ([Demand], DmdResult)
- strictSigDmdEnv :: StrictSig -> DmdEnv
- increaseStrictSigArity :: Int -> StrictSig -> StrictSig
- etaExpandStrictSig :: Arity -> StrictSig -> StrictSig
- seqDemand :: Demand -> ()
- seqDemandList :: [Demand] -> ()
- seqDmdType :: DmdType -> ()
- seqStrictSig :: StrictSig -> ()
- evalDmd :: Demand
- cleanEvalDmd :: CleanDemand
- cleanEvalProdDmd :: Arity -> CleanDemand
- isStrictDmd :: JointDmd (Str s) (Use u) -> Bool
- splitDmdTy :: DmdType -> (Demand, DmdType)
- splitFVs :: Bool -> DmdEnv -> (DmdEnv, DmdEnv)
- deferAfterIO :: DmdType -> DmdType
- postProcessUnsat :: DmdShell -> DmdType -> DmdType
- postProcessDmdType :: DmdShell -> DmdType -> BothDmdArg
- splitProdDmd_maybe :: Demand -> Maybe [Demand]
- peelCallDmd :: CleanDemand -> (CleanDemand, DmdShell)
- peelManyCalls :: Int -> CleanDemand -> DmdShell
- mkCallDmd :: CleanDemand -> CleanDemand
- mkCallDmds :: Arity -> CleanDemand -> CleanDemand
- mkWorkerDemand :: Int -> Demand
- dmdTransformSig :: StrictSig -> CleanDemand -> DmdType
- dmdTransformDataConSig :: Arity -> StrictSig -> CleanDemand -> DmdType
- dmdTransformDictSelSig :: StrictSig -> CleanDemand -> DmdType
- argOneShots :: Demand -> [OneShotInfo]
- argsOneShots :: StrictSig -> Arity -> [[OneShotInfo]]
- saturatedByOneShots :: Int -> Demand -> Bool
- data TypeShape
- peelTsFuns :: Arity -> TypeShape -> Maybe TypeShape
- trimToType :: Demand -> TypeShape -> Demand
- useCount :: Use u -> Count
- isUsedOnce :: JointDmd (Str s) (Use u) -> Bool
- reuseEnv :: DmdEnv -> DmdEnv
- killUsageDemand :: DynFlags -> Demand -> Demand
- killUsageSig :: DynFlags -> StrictSig -> StrictSig
- zapUsageDemand :: Demand -> Demand
- zapUsageEnvSig :: StrictSig -> StrictSig
- zapUsedOnceDemand :: Demand -> Demand
- zapUsedOnceSig :: StrictSig -> StrictSig
- strictifyDictDmd :: Type -> Demand -> Demand
- strictifyDmd :: Demand -> Demand
Documentation
Domain for genuine usage
UCall Count UseDmd | Call demand for absence. Used only for values of function type |
UProd [ArgUse] | Product. Used only for values of product type See Note [Don't optimise UProd(Used) to Used] Invariant: Not all components are Abs (in that case, use UHead) |
UHead | May be used but its sub-components are definitely *not* used. For product types, UHead is equivalent to U(AAA); see mkUProd. UHead is needed only to express the demand
of Since (UCall _ Abs) is ill-typed, UHead doesn't make sense for lambdas |
Used | May be used and its sub-components may be used. (top of the lattice) |
type CleanDemand = JointDmd StrDmd UseDmd Source #
mkProdDmd :: [Demand] -> CleanDemand Source #
mkOnceUsedDmd :: CleanDemand -> Demand Source #
mkManyUsedDmd :: CleanDemand -> Demand Source #
toCleanDmd :: Demand -> (DmdShell, CleanDemand) Source #
strictenDmd :: Demand -> CleanDemand Source #
bothCleanDmd :: CleanDemand -> CleanDemand -> CleanDemand Source #
dmdTypeDepth :: DmdType -> Arity Source #
bothDmdType :: DmdType -> BothDmdArg -> DmdType Source #
nopDmdType :: DmdType Source #
botDmdType :: DmdType Source #
ensureArgs :: Arity -> DmdType -> DmdType Source #
This makes sure we can use the demand type with n arguments. It extends the argument list with the correct resTypeArgDmd. It also adjusts the DmdResult: Divergence survives additional arguments, CPR information does not (and definite converge also would not).
type BothDmdArg = (DmdEnv, Termination ()) Source #
mkBothDmdArg :: DmdEnv -> BothDmdArg Source #
toBothDmdArg :: DmdType -> BothDmdArg Source #
cprProdRes :: [DmdType] -> DmdResult Source #
vanillaCprProdRes :: Arity -> DmdResult Source #
appIsBottom :: StrictSig -> Int -> Bool Source #
Returns true if an application to n args would diverge or throw an exception See Note [Unsaturated applications]
isBottomingSig :: StrictSig -> Bool Source #
True if the signature diverges or throws an exception
pprIfaceStrictSig :: StrictSig -> SDoc Source #
The depth of the wrapped DmdType
encodes the arity at which it is safe
to unleash. Better construct this through mkStrictSigForArity
.
See Note [Understanding DmdType and StrictSig]
cprProdSig :: Arity -> StrictSig Source #
hasDemandEnvSig :: StrictSig -> Bool Source #
strictSigDmdEnv :: StrictSig -> DmdEnv Source #
increaseStrictSigArity :: Int -> StrictSig -> StrictSig Source #
Add extra arguments to a strictness signature.
In contrast to etaExpandStrictSig
, this prepends additional argument
demands and leaves CPR info intact.
etaExpandStrictSig :: Arity -> StrictSig -> StrictSig Source #
We are expanding (x y. e) to (x y z. e z).
In contrast to increaseStrictSigArity
, this appends extra arg demands if
necessary, potentially destroying the signature's CPR property.
seqDemandList :: [Demand] -> () Source #
seqDmdType :: DmdType -> () Source #
seqStrictSig :: StrictSig -> () Source #
cleanEvalProdDmd :: Arity -> CleanDemand Source #
isStrictDmd :: JointDmd (Str s) (Use u) -> Bool Source #
deferAfterIO :: DmdType -> DmdType Source #
postProcessDmdType :: DmdShell -> DmdType -> BothDmdArg Source #
peelCallDmd :: CleanDemand -> (CleanDemand, DmdShell) Source #
peelManyCalls :: Int -> CleanDemand -> DmdShell Source #
mkCallDmd :: CleanDemand -> CleanDemand Source #
Wraps the CleanDemand
with a one-shot call demand: d
-> C1(d)
.
mkCallDmds :: Arity -> CleanDemand -> CleanDemand Source #
mkCallDmds n d
returns C1(C1...(C1 d))
where there are n
C1
's.
mkWorkerDemand :: Int -> Demand Source #
dmdTransformSig :: StrictSig -> CleanDemand -> DmdType Source #
dmdTransformDataConSig :: Arity -> StrictSig -> CleanDemand -> DmdType Source #
dmdTransformDictSelSig :: StrictSig -> CleanDemand -> DmdType Source #
argOneShots :: Demand -> [OneShotInfo] Source #
argsOneShots :: StrictSig -> Arity -> [[OneShotInfo]] Source #
isUsedOnce :: JointDmd (Str s) (Use u) -> Bool Source #
zapUsageDemand :: Demand -> Demand Source #
zapUsageEnvSig :: StrictSig -> StrictSig Source #
zapUsedOnceDemand :: Demand -> Demand Source #
Remove all 1* information (but not C1 information) from the demand
zapUsedOnceSig :: StrictSig -> StrictSig Source #
Remove all 1* information (but not C1 information) from the strictness signature
strictifyDmd :: Demand -> Demand Source #