Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Documentation
minimize :: Var v => Term' vt v a -> Either (NonEmpty (v, [a])) (Maybe (Term' vt v a)) Source #
Algorithm for minimizing cycles of a `let rec`. This can improve generalization during typechecking and may also be more efficient for execution.
For instance:
minimize (let rec id x = x; g = id 42; y = id "hi" in g) ==> Just (let id x = x; g = id 42; y = id "hi" in g)
Gets rid of the let rec and replaces it with an ordinary `let`, such
that id
is suitably generalized.
Fails on the left if there are duplicate definitions.