ddc-core-0.2.0.1: Disciple Core language and type checker.

Safe HaskellSafe-Infered

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