ddc-core- Disciplined Disciple Compiler core language and type checker.

Safe HaskellSafe-Inferred



Trim the expressions passed to weakclo casts to just those terms that can affect the closure of the body.



trimX :: Ord n => Exp a n -> Exp a nSource

Trim an expression if it is a weakclo cast.

Non-recursive version. If you want to recursively trim closures, use transformUpX' (const trimX).

trimClosures :: Ord n => a -> [Exp a n] -> [Exp a n]Source

Trim the expressions of a weaken closure (XCast CastWeakenClosure) into only the free variables.

For example, trimClosures [build (k z. something k), else] = [build, something, else]