ghc-8.0.2: 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
- extendVarSet_C :: (Var -> Var -> Var) -> VarSet -> Var -> VarSet
- elemVarSet :: Var -> VarSet -> Bool
- varSetElems :: VarSet -> [Var]
- 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
- foldVarSet :: (Var -> a -> a) -> a -> VarSet -> a
- filterVarSet :: (Var -> Bool) -> VarSet -> VarSet
- transCloVarSet :: (VarSet -> VarSet) -> VarSet -> VarSet
- fixVarSet :: (VarSet -> VarSet) -> VarSet -> VarSet
- lookupVarSet :: VarSet -> Var -> Maybe Var
- lookupVarSetByName :: VarSet -> Name -> Maybe Var
- mapVarSet :: (Var -> Var) -> VarSet -> VarSet
- sizeVarSet :: VarSet -> Int
- seqVarSet :: VarSet -> ()
- elemVarSetByKey :: Unique -> VarSet -> Bool
- partitionVarSet :: (Var -> Bool) -> VarSet -> (VarSet, VarSet)
- pluralVarSet :: VarSet -> SDoc
- pprVarSet :: ([Var] -> SDoc) -> VarSet -> 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
- 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
- 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 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 #

type TyVarSet = UniqSet TyVar Source #

type CoVarSet = UniqSet CoVar Source #

type TyCoVarSet = UniqSet TyCoVar Source #

## Manipulating these sets

emptyVarSet :: VarSet Source #

unitVarSet :: Var -> VarSet Source #

mkVarSet :: [Var] -> VarSet Source #

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

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

extendVarSet_C :: (Var -> Var -> Var) -> VarSet -> Var -> VarSet Source #

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

varSetElems :: VarSet -> [Var] 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 #

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

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

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

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

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

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

mapVarSet :: (Var -> Var) -> VarSet -> VarSet 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

:: ([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

type DVarSet = UniqDSet Var Source #

type DIdSet = UniqDSet Id Source #

type DTyVarSet = UniqDSet TyVar Source #

type DTyCoVarSet = UniqDSet TyCoVar Source #

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

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 #

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