ghc-8.0.2: The GHC API

VarSet

Synopsis

# Var, Id and TyVar set types

A non-deterministic set of variables. See Note [Deterministic UniqFM] in UniqDFM 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.

## Manipulating these sets

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

map the function over the list, and union the results

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

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

Arguments

 :: ([Var] -> SDoc) The pretty printing function to use on the elements -> VarSet The things to be pretty printed -> 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 varSetElems.

# Deterministic Var set types

## Manipulating these sets

Add a list of variables to DVarSet

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

Map the function over the list, and union the results

True if non-empty intersection

True if empty intersection

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

Delete a list of variables from DVarSet

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

transCloVarSet for DVarSet

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

Partition DVarSet according to the predicate given

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