hermit-0.1.8.0: Haskell Equational Reasoning Model-to-Implementation Tunnel

Safe HaskellNone

Language.HERMIT.Primitive.AlphaConversion

Contents

Synopsis

Alpha-Renaming and Shadowing

externals :: [External]Source

Externals for alpha-renaming.

Alpha-Renaming

alpha :: RewriteH CoreSource

Alpha rename any bindings at this node. Note: does not rename case alternatives unless invoked on the alternative.

alphaLam :: Maybe Name -> RewriteH CoreExprSource

Alpha rename a lambda binder. Optionally takes a suggested new name.

alphaCaseBinder :: Maybe Name -> RewriteH CoreExprSource

Alpha rename a case binder. Optionally takes a suggested new name.

alphaAltWith :: [Name] -> RewriteH CoreAltSource

Rename the variables bound in a case alternative with the given list of suggested names.

alphaAltVars :: [Var] -> RewriteH CoreAltSource

Rename the specified variables in a case alternative.

alphaAlt :: RewriteH CoreAltSource

Rename all identifiers bound in a case alternative.

alphaCase :: RewriteH CoreExprSource

Rename all identifiers bound in a case expression.

alphaLetWith :: [Name] -> RewriteH CoreExprSource

Rename the identifiers bound in a Let with the given list of suggested names.

alphaLetVars :: [Var] -> RewriteH CoreExprSource

Rename the specified variables bound in a let.

alphaLet :: RewriteH CoreExprSource

Rename all identifiers bound in a Let.

alphaConsWith :: [Name] -> RewriteH CoreProgSource

Rename the identifiers bound in the top-level binding at the head of the program with the given list of suggested names.

Shadow Detection and Unshadowing

unshadow :: RewriteH CoreSource

Rename local variables with manifestly unique names (x, x0, x1, ...). Does not rename top-level definitions.

visibleVarsT :: TranslateH CoreExpr [Var]Source

List all visible identifiers (in the expression or the context).

freshNameGenT :: Maybe Name -> TranslateH CoreExpr (String -> String)Source

If a name is provided replace the string with that, otherwise modify the string making sure to not clash with any visible variables.

freshNameGenAvoiding :: Maybe Name -> [Var] -> String -> StringSource

Use the optional argument if given, otherwise generate a new name avoiding clashes with the list of variables.

replaceVarR :: Injection a Core => Var -> Var -> RewriteH aSource

Replace all occurrences of a specified variable. Arguments are the variable to replace and the replacement variable, respectively.