Stability | experimental |
---|---|

Maintainer | developer@flocc.net |

Safe Haskell | None |

For more information please see http://www.flocc.net/

- preprocessExpr :: Monad m => [(String, Idx)] -> Expr -> StateT IdxSet m Expr
- unrollTupLets :: Monad m => Expr -> StateT IdxSet m Expr
- propagateVarsTupsFuns :: Monad m => Expr -> StateT IdxSet m Expr
- newVarNames :: VarNameEnv -> Expr -> Expr
- expandTupVals :: Monad m => Map Idx TyScheme -> Map Idx Expr -> Expr -> StateT IdxSet m Expr
- showLetExprs :: String -> Expr -> String
- encapFunVars :: Monad m => [(Idx, TyScheme)] -> Expr -> IdxMonad m (Expr, [(Idx, TyScheme)])
- propLets :: Monad m => (Expr -> Bool) -> ExprEnv -> Expr -> StateT IdxSet m Expr
- constTrueFun :: Expr -> Bool
- emptyExprEnv :: Map k a

# Documentation

preprocessExpr :: Monad m => [(String, Idx)] -> Expr -> StateT IdxSet m Expr

preprocessExpr expr. Applies all code tidying transformations to |an expression.

preprocessExpr expr. Applies all code tidying transformations to |an expression.

unrollTupLets :: Monad m => Expr -> StateT IdxSet m Expr

unrollTupLets takes an expression and expands all Let |expressions with tuple Idx trees to a sequence of nested |Lets - one for each identifier in the tree.

propagateVarsTupsFuns :: Monad m => Expr -> StateT IdxSet m Expr

propagateVarsTupsFuns takes an expression and propagates all |let bound lambdas, tuples and vars down to the leaves of the AST |(thus duplicating them where neccessary).

newVarNames :: VarNameEnv -> Expr -> Expr

newVarNames takes a map of new var names and an expression |and returns the same expression with new string names for |the vars.

expandTupVals :: Monad m => Map Idx TyScheme -> Map Idx Expr -> Expr -> StateT IdxSet m Expr

expandTupVals takes the types of all expressions in the AST |and replaces all identifiers of tuple type, with tuple expressions of |other identifiers, such that identifiers only ever refer to single values, |not tuples.

showLetExprs :: String -> Expr -> String

showLetExprs is a pretty print function for |expressions that are mainly lists of let expressions.

encapFunVars :: Monad m => [(Idx, TyScheme)] -> Expr -> IdxMonad m (Expr, [(Idx, TyScheme)])

encapFunVarsM types expr. Returns expr where all occurances of vars with function |types that are not immediately applied (direct children of App exprs) and encapsulated |in simple lambda terms e.g. (x -> v x)

propLets :: Monad m => (Expr -> Bool) -> ExprEnv -> Expr -> StateT IdxSet m Expr

propLets propagates bindings made at let expressions | (that match the filter predicate) down |to the leaves of an expression, when they can be, thus |eliminating uneccesary let expressions from the program

constTrueFun :: Expr -> Bool

constTrueFun takes an expression and always returns true.

emptyExprEnv :: Map k a