|Version 3 (modified by 10 years ago) (diff),|
type DmdEnv = VarEnv Demand
type DmdEnv = Env CoreExpr Demand
We keep track of demands on partial applications.
After calling dmd_anal on the body of a let, which results in demand type
dmd_ty with demand env
dmd_env, we do the following for each let-bound variable
- Iterate through all the keys in
dmd_env, finding all applications of
fto n arguments.
- For each i from 1 through n (where n is
f's arity), if each of the applications of
fto i arguments has usage demand
OneOrZero, then it's safe to mark the corresponding lambda-expression as a one-shot lambda.
This might work, but is kind of kludgy.