FV

ghc-8.0.0.20160421: The GHC API

Safe Haskell | None
Language | Haskell2010

FV

Contents

- Deterministic free vars computations
- Running the computations
  - Manipulating those computations

Synopsis

- type FV = InterestingVarFun -> VarSet -> ([Var], VarSet) -> ([Var], VarSet)
- type InterestingVarFun = Var -> Bool
- runFV :: FV -> ([Var], VarSet)
- runFVList :: FV -> [Var]
- runFVSet :: FV -> VarSet
- runFVDSet :: FV -> DVarSet
- oneVar :: Id -> FV
- noVars :: FV
- someVars :: [Var] -> FV
- unionFV :: FV -> FV -> FV
- unionsFV :: [FV] -> FV
- delFV :: Var -> FV -> FV
- delFVs :: VarSet -> FV -> FV
- filterFV :: InterestingVarFun -> FV -> FV
- mapUnionFV :: (a -> FV) -> [a] -> FV

# Deterministic free vars computations

type FV = InterestingVarFun -> VarSet -> ([Var], VarSet) -> ([Var], VarSet) Source #

type InterestingVarFun = Var -> Bool Source #

Predicate on possible free variables: returns `True` iff the variable is interesting

# Running the computations

runFV :: FV -> ([Var], VarSet) Source #

Run a free variable computation, returning a list of distinct free variables in deterministic order and a non-deterministic set containing those variables.

runFVList :: FV -> [Var] Source #

Run a free variable computation, returning a list of distinct free variables in deterministic order.

runFVSet :: FV -> VarSet Source #

Run a free variable computation, returning a non-deterministic set of free variables. Don't use if the set will be later converted to a list and the order of that list will impact the generated code.

runFVDSet :: FV -> DVarSet Source #

Run a free variable computation, returning a deterministic set of free variables. Note that this is just a wrapper around the version that returns a deterministic list. If you need a list you should use `runFVList`.

## Manipulating those computations

oneVar :: Id -> FV Source #

Add a variable - when free, to the returned free variables. Ignores duplicates and respects the filtering function.

noVars :: FV Source #

Return no free variables.

someVars :: [Var] -> FV Source #

Add multiple variables - when free, to the returned free variables. Ignores duplicates and respects the filtering function.

unionFV :: FV -> FV -> FV Source #

Union two free variable computations.

unionsFV :: [FV] -> FV Source #

Union many free variable computations.

delFV :: Var -> FV -> FV Source #

Mark the variable as not free by putting it in scope.

delFVs :: VarSet -> FV -> FV Source #

Mark many free variables as not free.

filterFV :: InterestingVarFun -> FV -> FV Source #

Filter a free variable computation.

mapUnionFV :: (a -> FV) -> [a] -> FV Source #

Map a free variable computation over a list and union the results.