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

Safe HaskellSafe-Inferred

DDC.Type.Transform.Trim

Synopsis

Documentation

trimClosure :: Ord n => Closure n -> Maybe (Closure n)Source

Trim compound closures into their components.

This is like crushEffect, but for closures instead of effects.

For example, trimming DeepUse (Int r2 -(Read r1 | Use r1)> Int r2) yields just Use r1. Only r1 might contain an actual store object that is reachable from a function closure with such a type.

This function assumes the closure is well-kinded, and may return Nothing if this is not the case.