HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduleghc-9.10.3GHC2021

GHC.Utils.FV

Utilities for efficiently and deterministically computing free variables.

  • 2 types
  • 12 values
  • Packageghc-9.10.3
  • Exports14
  • LanguageGHC2021
  • LicenceBSD-3-Clause
  • SourceFV.hs

Deterministic free vars computations

2 declarations
typetype InterestingVarFun = Var -> Bool
#

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

Running the computations

3 declarations
valuefvVarList :: FV -> [Var]
#

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

valuefvVarSet :: FV -> VarSet
#

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.

valuefvDVarSet :: FV -> DVarSet
#

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 fvVarList.

Manipulating those computations

valueunitFV :: Id -> FV
#

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

valuemkFVs :: [Var] -> FV
#

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

valueunionFV :: FV -> FV -> FV
#

Union two free variable computations.

valueunionsFV :: [FV] -> FV
#

Union many free variable computations.

valuedelFV :: Var -> FV -> FV
#

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

valuemapUnionFV :: (a -> FV) -> [a] -> FV
#

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