VarSet

ghc-8.6.0.20180810: The GHC API

Safe Haskell | None
Language | Haskell2010

VarSet

Contents

- Var, Id and TyVar set types
  - Manipulating these sets
- Deterministic Var set types
  - Manipulating these sets

Synopsis

- type VarSet = UniqSet Var
- type IdSet = UniqSet Id
- type TyVarSet = UniqSet TyVar
- type CoVarSet = UniqSet CoVar
- type TyCoVarSet = UniqSet TyCoVar
- emptyVarSet :: VarSet
- unitVarSet :: Var -> VarSet
- mkVarSet :: [Var] -> VarSet
- extendVarSet :: VarSet -> Var -> VarSet
- extendVarSetList :: VarSet -> [Var] -> VarSet
- elemVarSet :: Var -> VarSet -> Bool
- subVarSet :: VarSet -> VarSet -> Bool
- unionVarSet :: VarSet -> VarSet -> VarSet
- unionVarSets :: [VarSet] -> VarSet
- mapUnionVarSet :: (a -> VarSet) -> [a] -> VarSet
- intersectVarSet :: VarSet -> VarSet -> VarSet
- intersectsVarSet :: VarSet -> VarSet -> Bool
- disjointVarSet :: VarSet -> VarSet -> Bool
- isEmptyVarSet :: VarSet -> Bool
- delVarSet :: VarSet -> Var -> VarSet
- delVarSetList :: VarSet -> [Var] -> VarSet
- delVarSetByKey :: VarSet -> Unique -> VarSet
- minusVarSet :: VarSet -> VarSet -> VarSet
- filterVarSet :: (Var -> Bool) -> VarSet -> VarSet
- mapVarSet :: Uniquable b => (a -> b) -> UniqSet a -> UniqSet b
- anyVarSet :: (Var -> Bool) -> VarSet -> Bool
- allVarSet :: (Var -> Bool) -> VarSet -> Bool
- transCloVarSet :: (VarSet -> VarSet) -> VarSet -> VarSet
- fixVarSet :: (VarSet -> VarSet) -> VarSet -> VarSet
- lookupVarSet_Directly :: VarSet -> Unique -> Maybe Var
- lookupVarSet :: VarSet -> Var -> Maybe Var
- lookupVarSetByName :: VarSet -> Name -> Maybe Var
- sizeVarSet :: VarSet -> Int
- seqVarSet :: VarSet -> ()
- elemVarSetByKey :: Unique -> VarSet -> Bool
- partitionVarSet :: (Var -> Bool) -> VarSet -> (VarSet, VarSet)
- pluralVarSet :: VarSet -> SDoc
- pprVarSet :: VarSet -> ([Var] -> SDoc) -> SDoc
- type DVarSet = UniqDSet Var
- type DIdSet = UniqDSet Id
- type DTyVarSet = UniqDSet TyVar
- type DTyCoVarSet = UniqDSet TyCoVar
- emptyDVarSet :: DVarSet
- unitDVarSet :: Var -> DVarSet
- mkDVarSet :: [Var] -> DVarSet
- extendDVarSet :: DVarSet -> Var -> DVarSet
- extendDVarSetList :: DVarSet -> [Var] -> DVarSet
- elemDVarSet :: Var -> DVarSet -> Bool
- dVarSetElems :: DVarSet -> [Var]
- subDVarSet :: DVarSet -> DVarSet -> Bool
- unionDVarSet :: DVarSet -> DVarSet -> DVarSet
- unionDVarSets :: [DVarSet] -> DVarSet
- mapUnionDVarSet :: (a -> DVarSet) -> [a] -> DVarSet
- intersectDVarSet :: DVarSet -> DVarSet -> DVarSet
- dVarSetIntersectVarSet :: DVarSet -> VarSet -> DVarSet
- intersectsDVarSet :: DVarSet -> DVarSet -> Bool
- disjointDVarSet :: DVarSet -> DVarSet -> Bool
- isEmptyDVarSet :: DVarSet -> Bool
- delDVarSet :: DVarSet -> Var -> DVarSet
- delDVarSetList :: DVarSet -> [Var] -> DVarSet
- minusDVarSet :: DVarSet -> DVarSet -> DVarSet
- foldDVarSet :: (Var -> a -> a) -> a -> DVarSet -> a
- filterDVarSet :: (Var -> Bool) -> DVarSet -> DVarSet
- dVarSetMinusVarSet :: DVarSet -> VarSet -> DVarSet
- anyDVarSet :: (Var -> Bool) -> DVarSet -> Bool
- allDVarSet :: (Var -> Bool) -> DVarSet -> Bool
- transCloDVarSet :: (DVarSet -> DVarSet) -> DVarSet -> DVarSet
- sizeDVarSet :: DVarSet -> Int
- seqDVarSet :: DVarSet -> ()
- partitionDVarSet :: (Var -> Bool) -> DVarSet -> (DVarSet, DVarSet)
- dVarSetToVarSet :: DVarSet -> VarSet

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

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

emptyVarSet :: VarSet Source #

unitVarSet :: Var -> VarSet Source #

mkVarSet :: [Var] -> VarSet Source #

extendVarSet :: VarSet -> Var -> VarSet Source #

extendVarSetList :: VarSet -> [Var] -> VarSet Source #

elemVarSet :: Var -> VarSet -> Bool Source #

subVarSet :: VarSet -> VarSet -> Bool Source #

unionVarSet :: VarSet -> VarSet -> VarSet Source #

unionVarSets :: [VarSet] -> VarSet Source #

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

map the function over the list, and union the results

intersectVarSet :: VarSet -> VarSet -> VarSet Source #

intersectsVarSet :: VarSet -> VarSet -> Bool Source #

disjointVarSet :: VarSet -> VarSet -> Bool Source #

isEmptyVarSet :: VarSet -> Bool Source #

delVarSet :: VarSet -> Var -> VarSet Source #

delVarSetList :: VarSet -> [Var] -> VarSet Source #

delVarSetByKey :: VarSet -> Unique -> VarSet Source #

minusVarSet :: VarSet -> VarSet -> VarSet Source #

filterVarSet :: (Var -> Bool) -> VarSet -> VarSet Source #

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

anyVarSet :: (Var -> Bool) -> VarSet -> Bool Source #

allVarSet :: (Var -> Bool) -> VarSet -> Bool Source #

transCloVarSet :: (VarSet -> VarSet) -> VarSet -> VarSet Source #

fixVarSet :: (VarSet -> VarSet) -> VarSet -> VarSet Source #

lookupVarSet_Directly :: VarSet -> Unique -> Maybe Var Source #

lookupVarSet :: VarSet -> Var -> Maybe Var Source #

lookupVarSetByName :: VarSet -> Name -> Maybe Var Source #

sizeVarSet :: VarSet -> Int Source #

seqVarSet :: VarSet -> () Source #

elemVarSetByKey :: Unique -> VarSet -> Bool Source #

partitionVarSet :: (Var -> Bool) -> VarSet -> (VarSet, VarSet) 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.

# 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

emptyDVarSet :: DVarSet Source #

unitDVarSet :: Var -> DVarSet Source #

mkDVarSet :: [Var] -> DVarSet Source #

extendDVarSet :: DVarSet -> Var -> DVarSet Source #

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

Add a list of variables to DVarSet

elemDVarSet :: Var -> DVarSet -> Bool Source #

dVarSetElems :: DVarSet -> [Var] Source #

subDVarSet :: DVarSet -> DVarSet -> Bool Source #

unionDVarSet :: DVarSet -> DVarSet -> DVarSet Source #

unionDVarSets :: [DVarSet] -> DVarSet Source #

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

Map the function over the list, and union the results

intersectDVarSet :: DVarSet -> DVarSet -> DVarSet Source #

dVarSetIntersectVarSet :: DVarSet -> VarSet -> DVarSet Source #

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

True if non-empty intersection

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

True if empty intersection

isEmptyDVarSet :: DVarSet -> Bool Source #

delDVarSet :: DVarSet -> Var -> DVarSet Source #

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

Delete a list of variables from DVarSet

minusDVarSet :: DVarSet -> DVarSet -> DVarSet Source #

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

filterDVarSet :: (Var -> Bool) -> DVarSet -> DVarSet Source #

dVarSetMinusVarSet :: DVarSet -> VarSet -> DVarSet Source #

anyDVarSet :: (Var -> Bool) -> DVarSet -> Bool Source #

allDVarSet :: (Var -> Bool) -> DVarSet -> Bool Source #

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

transCloVarSet for DVarSet

sizeDVarSet :: DVarSet -> Int Source #

seqDVarSet :: DVarSet -> () Source #

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 forgeting the order of insertion