Safe Haskell | None |
---|
- externals :: [External]
- coreExprFreeIds :: CoreExpr -> [Id]
- coreExprFreeVars :: CoreExpr -> [Var]
- freeIdsT :: TranslateH CoreExpr [Id]
- freeVarsT :: TranslateH CoreExpr [Var]
- altFreeVarsT :: TranslateH CoreAlt [Var]
- altFreeVarsExclWildT :: TranslateH CoreAlt (Id -> [Var])
- substR :: Var -> CoreExpr -> RewriteH Core
- letSubstR :: RewriteH CoreExpr
- safeLetSubstR :: RewriteH CoreExpr
- safeLetSubstPlusR :: RewriteH CoreExpr
- inScope :: HermitC -> Id -> Bool
- exprEqual :: CoreExpr -> CoreExpr -> Bool
- showVars :: [Var] -> String
- rules :: String -> RewriteH CoreExpr
GHC-based Transformations
This module contains transformations that are reflections of GHC functions, or derived from GHC functions.
Externals that reflect GHC functions, or are derived from GHC functions.
Free Variables
coreExprFreeIds :: CoreExpr -> [Id]Source
List all free identifiers (value-level free variables) in the expression.
coreExprFreeVars :: CoreExpr -> [Var]Source
List all free variables (including types) in the expression.
freeIdsT :: TranslateH CoreExpr [Id]Source
Lifted version of coreExprFreeIds
.
freeVarsT :: TranslateH CoreExpr [Var]Source
Lifted version of coreExprFreeVars
.
altFreeVarsT :: TranslateH CoreAlt [Var]Source
The free variables in a case alternative, which excludes any identifiers bound in the alternative.
altFreeVarsExclWildT :: TranslateH CoreAlt (Id -> [Var])Source
A variant of altFreeVarsT
that returns a function that accepts the case wild-card binder before giving a result.
This is so we can use this with congruence combinators, for example:
caseT id (const altFreeVarsT) $ _ wild _ fvs -> [ f wild | f <- fvs ]
Substitution
substR :: Var -> CoreExpr -> RewriteH CoreSource
Substitute all occurrences of a variable with an expression, in either a program or an expression.
safeLetSubstR :: RewriteH CoreExprSource
This is quite expensive (O(n) for the size of the sub-tree).
safeLetSubstPlusR :: RewriteH CoreExprSource
safeLetSubstPlusR
tries to inline a stack of bindings, stopping when reaches
the end of the stack of lets.