YhcSource codeContentsIndex
Yhc.Core.FreeVar3
Description

In: x -> y x

x is bound

y is free

Synopsis
collectAllVars :: CoreExpr -> [CoreVarName]
collectBoundVars :: CoreExpr -> [CoreVarName]
collectFreeVars :: CoreExpr -> [CoreVarName]
countFreeVar :: CoreVarName -> CoreExpr -> Int
uniplateBoundVars :: CoreExpr -> ([CoreVarName], [CoreVarName] -> CoreExpr)
replaceFreeVars :: [(CoreVarName, CoreExpr)] -> CoreExpr -> CoreExpr
replaceFreeVarsUnique :: UniqueIdM m => [(CoreVarName, CoreExpr)] -> CoreExpr -> m CoreExpr
freeVars :: Char -> [String]
getVar :: UniqueIdM m => m CoreVarName
getVars :: UniqueIdM m => Int -> m [CoreVarName]
duplicateExpr :: UniqueIdM m => CoreExpr -> m CoreExpr
checkFreeVar :: CoreExpr -> CoreExpr -> Bool
uniqueBoundVarsCore :: UniqueIdM m => Core -> m Core
uniqueBoundVarsFunc :: UniqueIdM m => CoreFunc -> m CoreFunc
uniqueBoundVars :: UniqueIdM m => CoreExpr -> m CoreExpr
Documentation
collectAllVars :: CoreExpr -> [CoreVarName]
Which variables are mentioned in an expression
collectBoundVars :: CoreExpr -> [CoreVarName]
Which variables are introduced at any point, i.e. LHS of a case alternative, or by a let
collectFreeVars :: CoreExpr -> [CoreVarName]
Which variables are in the used in an expression before being defined. No variable will occur more than once
countFreeVar :: CoreVarName -> CoreExpr -> Int
Count the number of uses of a free variable. If a variable is used in different branches of a case, it is only considered to be the maximum of these two branches.
uniplateBoundVars :: CoreExpr -> ([CoreVarName], [CoreVarName] -> CoreExpr)
Get the variables that are defined to one-level depth and a function to replace them
replaceFreeVars :: [(CoreVarName, CoreExpr)] -> CoreExpr -> CoreExpr
Replace all free occurances of variables with a new expression
replaceFreeVarsUnique :: UniqueIdM m => [(CoreVarName, CoreExpr)] -> CoreExpr -> m CoreExpr
freeVars :: Char -> [String]
getVar :: UniqueIdM m => m CoreVarName
getVars :: UniqueIdM m => Int -> m [CoreVarName]
duplicateExpr :: UniqueIdM m => CoreExpr -> m CoreExpr
checkFreeVar :: CoreExpr -> CoreExpr -> Bool

Check that the free variables in the second expression are also in the first one. It usually indicates an error to introduce new free variables in transformation.

Return True for safe, False for probably buggy.

uniqueBoundVarsCore :: UniqueIdM m => Core -> m Core
Make a whole Core program have unique free variables.
uniqueBoundVarsFunc :: UniqueIdM m => CoreFunc -> m CoreFunc
Make a whole function have unique free variables
uniqueBoundVars :: UniqueIdM m => CoreExpr -> m CoreExpr
Take care: If v123 is a free variable, then make sure getVar starts above that
Produced by Haddock version 0.8