ghc-8.0.1: The GHC API

Safe HaskellNone
LanguageHaskell2010

CoreFVs

Contents

Description

A module concerned with finding the free variables of an expression.

Synopsis

Free variables of expressions and binding groups

exprFreeVars :: CoreExpr -> VarSet #

Find all locally-defined free Ids or type variables in an expression returning a non-deterministic set.

exprFreeVarsDSet :: CoreExpr -> DVarSet #

Find all locally-defined free Ids or type variables in an expression returning a deterministic set.

exprFreeIds :: CoreExpr -> IdSet #

Find all locally-defined free Ids in an expression

exprsFreeVars :: [CoreExpr] -> VarSet #

Find all locally-defined free Ids or type variables in several expressions returning a non-deterministic set.

exprsFreeVarsList :: [CoreExpr] -> [Var] #

Find all locally-defined free Ids or type variables in several expressions returning a deterministically ordered list.

bindFreeVars :: CoreBind -> VarSet #

Find all locally defined free Ids in a binding group

Selective free variables of expressions

type InterestingVarFun = Var -> Bool #

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

exprSomeFreeVars #

Arguments

:: InterestingVarFun

Says which Vars are interesting

-> CoreExpr 
-> VarSet 

Finds free variables in an expression selected by a predicate

exprsSomeFreeVars :: InterestingVarFun -> [CoreExpr] -> VarSet #

Finds free variables in several expressions selected by a predicate

Free variables of Rules, Vars and Ids

ruleRhsFreeVars :: CoreRule -> VarSet #

Those variables free in the right hand side of a rule returned as a non-deterministic set

ruleFreeVars :: CoreRule -> VarSet #

Those variables free in the both the left right hand sides of a rule returned as a non-deterministic set

rulesFreeVars :: [CoreRule] -> VarSet #

Those variables free in the right hand side of several rules

rulesFreeVarsDSet :: [CoreRule] -> DVarSet #

Those variables free in the both the left right hand sides of rules returned as a deterministic set

ruleLhsFreeIds :: CoreRule -> VarSet #

This finds all locally-defined free Ids on the left hand side of a rule

vectsFreeVars :: [CoreVect] -> VarSet #

Free variables of a vectorisation declaration

Orphan names

exprsOrphNames :: [CoreExpr] -> NameSet #

Finds the free external names of several expressions: see exprOrphNames for details

orphNamesOfFamInst :: FamInst -> NameSet #

orphNamesOfAxiom collects the names of the concrete types and type constructors that make up the LHS of a type family instance, including the family name itself.

For instance, given `type family Foo a b`: `type instance Foo (F (G (H a))) b = ...` would yield [Foo,F,G,H]

Used in the implementation of ":info" in GHCi.

Core syntax tree annotation with free variables

data FVAnn #

type CoreExprWithFVs = AnnExpr Id FVAnn #

Every node in an expression annotated with its (non-global) free variables, both Ids and TyVars, and type.

type CoreBindWithFVs = AnnBind Id FVAnn #

Every node in a binding group annotated with its (non-global) free variables, both Ids and TyVars, and type.

type CoreAltWithFVs = AnnAlt Id FVAnn #

Every node in an expression annotated with its (non-global) free variables, both Ids and TyVars, and type.

freeVars :: CoreExpr -> CoreExprWithFVs #

Annotate a CoreExpr with its (non-global) free type and value variables at every tree node

freeVarsOf :: CoreExprWithFVs -> DIdSet #

Inverse function to freeVars

freeVarsOfType :: CoreExprWithFVs -> DTyCoVarSet #

Extract the vars free in an annotated expression's type

freeVarsOfAnn :: FVAnn -> DIdSet #

Extract the vars reported in a FVAnn

freeVarsOfTypeAnn :: FVAnn -> DTyCoVarSet #

Extract the type-level vars reported in a FVAnn

exprTypeFV :: CoreExprWithFVs -> Type #

Extract the type of an annotated expression. (This is cheap.)