ghc-9.2.0.20210821: The GHC API
Safe HaskellSafe-Inferred
LanguageHaskell2010

GHC.Types.Var.Set

Synopsis

Var, Id and TyVar set types

type VarSet = UniqSet Var Source #

A non-deterministic Variable Set

A non-deterministic set of variables. See Note [Deterministic UniqFM] in GHC.Types.Unique.DFM for explanation why it's not deterministic and why it matters. Use DVarSet if the set eventually gets converted into a list or folded over in a way where the order changes the generated code, for example when abstracting variables.

type IdSet = UniqSet Id Source #

Identifier Set

type TyVarSet = UniqSet TyVar Source #

Type Variable Set

type CoVarSet = UniqSet CoVar Source #

Coercion Variable Set

type TyCoVarSet = UniqSet TyCoVar Source #

Type or Coercion Variable Set

Manipulating these sets

mapUnionVarSet :: (a -> VarSet) -> [a] -> VarSet Source #

map the function over the list, and union the results

mapVarSet :: Uniquable b => (a -> b) -> UniqSet a -> UniqSet b Source #

pluralVarSet :: VarSet -> SDoc Source #

Determines the pluralisation suffix appropriate for the length of a set in the same way that plural from Outputable does for lists.

pprVarSet Source #

Arguments

:: VarSet

The things to be pretty printed

-> ([Var] -> SDoc)

The pretty printing function to use on the elements

-> SDoc

SDoc where the things have been pretty printed

Pretty-print a non-deterministic set. The order of variables is non-deterministic and for pretty-printing that shouldn't be a problem. Having this function helps contain the non-determinism created with nonDetEltsUFM. Passing a list to the pretty-printing function allows the caller to decide on the order of Vars (eg. toposort them) without them having to use nonDetEltsUFM at the call site. This prevents from let-binding non-deterministically ordered lists and reusing them where determinism matters.

nonDetStrictFoldVarSet :: (Var -> a -> a) -> a -> VarSet -> a Source #

Deterministic Var set types

type DVarSet = UniqDSet Var Source #

Deterministic Variable Set

type DIdSet = UniqDSet Id Source #

Deterministic Identifier Set

type DTyVarSet = UniqDSet TyVar Source #

Deterministic Type Variable Set

type DTyCoVarSet = UniqDSet TyCoVar Source #

Deterministic Type or Coercion Variable Set

Manipulating these sets

extendDVarSetList :: DVarSet -> [Var] -> DVarSet Source #

Add a list of variables to DVarSet

mapUnionDVarSet :: (a -> DVarSet) -> [a] -> DVarSet Source #

Map the function over the list, and union the results

intersectsDVarSet :: DVarSet -> DVarSet -> Bool Source #

True if non-empty intersection

disjointDVarSet :: DVarSet -> DVarSet -> Bool Source #

True if empty intersection

delDVarSetList :: DVarSet -> [Var] -> DVarSet Source #

Delete a list of variables from DVarSet

nonDetStrictFoldDVarSet :: (Var -> a -> a) -> a -> DVarSet -> a Source #

mapDVarSet :: Uniquable b => (a -> b) -> UniqDSet a -> UniqDSet b Source #

transCloDVarSet :: (DVarSet -> DVarSet) -> DVarSet -> DVarSet Source #

transCloVarSet for DVarSet

partitionDVarSet :: (Var -> Bool) -> DVarSet -> (DVarSet, DVarSet) Source #

Partition DVarSet according to the predicate given

dVarSetToVarSet :: DVarSet -> VarSet Source #

Convert a DVarSet to a VarSet by forgetting the order of insertion