Module FlatCurry.Transform.Exec

Author
Michael Hanus, Steven Libby
Version
August 2025

Implementation of transforming FlatCurry expressions by applying non-deterministically defined expressions transformations as long as possible.

Exported Functions


transformExpr :: (() -> (Int, [Int]) -> Expr -> (Expr, String, Int)) -> Int -> Expr -> Expr  Deterministic 

Simplifies a FlatCurry expression according to some expression transformation. Since the expression transformation can be non-deterministically defined, we pass it as a function which is similarly to passing it via run-time choice. The second argument is the maximum number of transformation steps to be applied. If the number is -1, then keep going until no transformation can be applied.

Although the single transformation steps can be non-deterministic, the strategy to apply such steps is deterministic since it is applied in a bottom-up manner: if there is some node to be transformed, all child nodes are transformed before transformation rules are applied to the node itself.

Further infos:
  • might behave indeterministically

transformExprN :: (() -> (Int, [Int]) -> Expr -> (Expr, String, Int)) -> Int -> Expr -> (Expr, Int)  Deterministic 

The same as transformExpr but return also the number of applied transformation steps.

Further infos:
  • might behave indeterministically

showTransformExpr :: (() -> (Int, [Int]) -> Expr -> (Expr, String, Int)) -> Int -> Expr -> (Expr, String, Int)  Deterministic 

Further infos:
  • might behave indeterministically