Module FlatCurry.Typed.Simplify

A simplifier for type-annotated FlatCurry programs. In particular, it replaces calls to Eq.== implementations by Prelude.==

Author: Michael Hanus

Version: September 2024

Summary of exported operations:

simpProg :: AProg TypeExpr -> AProg TypeExpr  Deterministic 
simpFuncDecl :: AFuncDecl TypeExpr -> AFuncDecl TypeExpr  Deterministic 
simpExpr :: AExpr TypeExpr -> AExpr TypeExpr  Deterministic 

Implements the following transformations:

  • simplify equality instance on lists
  • simplify EQ.== calls
  • simplify uses of otherwise: case otherwise of { True -> e1 ; False -> e2 } ==> e1
  • simplify application of Prelude.$: f $ e ==> f e
  • simplify Prelude.apply for partially applied first arguments

Exported operations:

simpExpr :: AExpr TypeExpr -> AExpr TypeExpr  Deterministic 

Implements the following transformations:

  • simplify equality instance on lists
  • simplify EQ.== calls
  • simplify uses of otherwise: case otherwise of { True -> e1 ; False -> e2 } ==> e1
  • simplify application of Prelude.$: f $ e ==> f e
  • simplify Prelude.apply for partially applied first arguments