ddc-core- Disciple Core language and type checker.

Safe HaskellSafe-Inferred




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 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.