YhcSource codeContentsIndex
Yhc.Core.FreeVar2
Description

In: x -> y x

x is bound

y is free

Synopsis
data FreeVar a
runFreeVars :: FreeVar a -> a
freeVars :: Char -> [String]
putVars :: [String] -> FreeVar ()
getVars :: FreeVar [String]
getVar :: FreeVar String
deleteVars :: [String] -> FreeVar ()
collectAllVars :: CoreExpr -> [CoreVarName]
collectBoundVars :: CoreExpr -> [CoreVarName]
collectFreeVars :: CoreExpr -> [CoreVarName]
countFreeVar :: CoreVarName -> CoreExpr -> Int
replaceFreeVars :: [(CoreVarName, CoreExpr)] -> CoreExpr -> CoreExpr
uniqueBoundVarsCore :: Core -> FreeVar Core
uniqueBoundVarsFunc :: CoreFunc -> FreeVar CoreFunc
uniqueBoundVars :: CoreExpr -> FreeVar CoreExpr
Documentation
data FreeVar a
show/hide Instances
Monad FreeVar
runFreeVars :: FreeVar a -> a
freeVars :: Char -> [String]
putVars :: [String] -> FreeVar ()
getVars :: FreeVar [String]
getVar :: FreeVar String
deleteVars :: [String] -> FreeVar ()
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.
replaceFreeVars :: [(CoreVarName, CoreExpr)] -> CoreExpr -> CoreExpr
Replace all free occurances of variables with a new expression
uniqueBoundVarsCore :: Core -> FreeVar Core
Make a whole Core program have unique free variables.
uniqueBoundVarsFunc :: CoreFunc -> FreeVar CoreFunc
Make a whole function have unique free variables
uniqueBoundVars :: CoreExpr -> FreeVar CoreExpr

Replace all variables which are locally defined with new names from the given list. Raises an error if not enough free variables are supplied

If any in the new list clashes with a name in collectFreeVars this will return a program with different semantics!

Property: collectFreeVars (uniqueFreeVarsWith newvars x) subset newvars

Produced by Haddock version 0.8