GHC.Types.Unique.Set

ghc-lib-parser-9.14.1.20251220: The GHC API, decoupled from GHC versions

Safe Haskell | Ignore
Language | GHC2021

GHC.Types.Unique.Set

Contents

- Unique set type
  - Manipulating these sets

Synopsis

- data UniqSet a
- getUniqSet :: UniqSet a -> UniqFM a a
- pprUniqSet :: (a -> SDoc) -> UniqSet a -> SDoc
- emptyUniqSet :: UniqSet a
- unitUniqSet :: Uniquable a => a -> UniqSet a
- mkUniqSet :: Uniquable a => [a] -> UniqSet a
- addOneToUniqSet :: Uniquable a => UniqSet a -> a -> UniqSet a
- addListToUniqSet :: Uniquable a => UniqSet a -> [a] -> UniqSet a
- delOneFromUniqSet :: Uniquable a => UniqSet a -> a -> UniqSet a
- delOneFromUniqSet_Directly :: UniqSet a -> Unique -> UniqSet a
- delListFromUniqSet :: Uniquable a => UniqSet a -> [a] -> UniqSet a
- delListFromUniqSet_Directly :: UniqSet a -> [Unique] -> UniqSet a
- unionUniqSets :: UniqSet a -> UniqSet a -> UniqSet a
- unionManyUniqSets :: [UniqSet a] -> UniqSet a
- minusUniqSet :: UniqSet a -> UniqSet a -> UniqSet a
- uniqSetMinusUFM :: UniqSet key -> UniqFM key b -> UniqSet key
- uniqSetMinusUDFM :: UniqSet key -> UniqDFM key b -> UniqSet key
- intersectUniqSets :: UniqSet a -> UniqSet a -> UniqSet a
- disjointUniqSets :: UniqSet a -> UniqSet a -> Bool
- restrictUniqSetToUFM :: UniqSet key -> UniqFM key b -> UniqSet key
- uniqSetAny :: (a -> Bool) -> UniqSet a -> Bool
- uniqSetAll :: (a -> Bool) -> UniqSet a -> Bool
- elementOfUniqSet :: Uniquable a => a -> UniqSet a -> Bool
- elemUniqSet_Directly :: Unique -> UniqSet a -> Bool
- filterUniqSet :: (a -> Bool) -> UniqSet a -> UniqSet a
- filterUniqSet_Directly :: (Unique -> elt -> Bool) -> UniqSet elt -> UniqSet elt
- sizeUniqSet :: UniqSet a -> Int
- isEmptyUniqSet :: UniqSet a -> Bool
- lookupUniqSet :: Uniquable key => UniqSet key -> key -> Maybe key
- lookupUniqSet_Directly :: UniqSet a -> Unique -> Maybe a
- partitionUniqSet :: (a -> Bool) -> UniqSet a -> (UniqSet a, UniqSet a)
- mapUniqSet :: Uniquable b => (a -> b) -> UniqSet a -> UniqSet b
- unsafeUFMToUniqSet :: UniqFM a a -> UniqSet a
- nonDetEltsUniqSet :: UniqSet elt -> [elt]
- nonDetKeysUniqSet :: UniqSet elt -> [Unique]
- nonDetStrictFoldUniqSet :: (elt -> a -> a) -> a -> UniqSet elt -> a
- mapMaybeUniqSet_sameUnique :: (a -> Maybe b) -> UniqSet a -> UniqSet b
- newtype UniqueSet = US {
  - unUniqueSet :: Word64Set
  }
- nullUniqueSet :: UniqueSet -> Bool
- sizeUniqueSet :: UniqueSet -> Int
- memberUniqueSet :: Unique -> UniqueSet -> Bool
- emptyUniqueSet :: UniqueSet
- singletonUniqueSet :: Unique -> UniqueSet
- insertUniqueSet :: Unique -> UniqueSet -> UniqueSet
- deleteUniqueSet :: Unique -> UniqueSet -> UniqueSet
- differenceUniqueSet :: UniqueSet -> UniqueSet -> UniqueSet
- unionUniqueSet :: UniqueSet -> UniqueSet -> UniqueSet
- unionsUniqueSet :: [UniqueSet] -> UniqueSet
- intersectionUniqueSet :: UniqueSet -> UniqueSet -> UniqueSet
- isSubsetOfUniqueSet :: UniqueSet -> UniqueSet -> Bool
- filterUniqueSet :: (Unique -> Bool) -> UniqueSet -> UniqueSet
- foldlUniqueSet :: (a -> Unique -> a) -> a -> UniqueSet -> a
- foldrUniqueSet :: (Unique -> b -> b) -> b -> UniqueSet -> b
- elemsUniqueSet :: UniqueSet -> [Unique]
- fromListUniqueSet :: [Unique] -> UniqueSet

# Unique set type

data UniqSet a #

Set of Uniquable values

#### Instances

Instances details

NFData a => NFData (UniqSet a) # |
Instance details Defined in GHC.Types.Unique.Set Methods rnf :: UniqSet a -> () #
Monoid (UniqSet a) # |
Instance details Defined in GHC.Types.Unique.Set Methods mempty :: UniqSet a # mappend :: UniqSet a -> UniqSet a -> UniqSet a # mconcat :: [UniqSet a] -> UniqSet a #
Semigroup (UniqSet a) # |
Instance details Defined in GHC.Types.Unique.Set Methods (<>) :: UniqSet a -> UniqSet a -> UniqSet a # sconcat :: NonEmpty (UniqSet a) -> UniqSet a # stimes :: Integral b => b -> UniqSet a -> UniqSet a #
Data a => Data (UniqSet a) # |
Instance details Defined in GHC.Types.Unique.Set Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> UniqSet a -> c (UniqSet a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (UniqSet a) # toConstr :: UniqSet a -> Constr # dataTypeOf :: UniqSet a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (UniqSet a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (UniqSet a)) # gmapT :: (forall b. Data b => b -> b) -> UniqSet a -> UniqSet a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UniqSet a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UniqSet a -> r # gmapQ :: (forall d. Data d => d -> u) -> UniqSet a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> UniqSet a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> UniqSet a -> m (UniqSet a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> UniqSet a -> m (UniqSet a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> UniqSet a -> m (UniqSet a) #
Outputable a => Outputable (UniqSet a) # |
Instance details Defined in GHC.Types.Unique.Set Methods ppr :: UniqSet a -> SDoc #
Eq (UniqSet a) # |
Instance details Defined in GHC.Types.Unique.Set Methods (==) :: UniqSet a -> UniqSet a -> Bool # (/=) :: UniqSet a -> UniqSet a -> Bool #

getUniqSet :: UniqSet a -> UniqFM a a #

pprUniqSet :: (a -> SDoc) -> UniqSet a -> SDoc #

## Manipulating these sets

emptyUniqSet :: UniqSet a #

unitUniqSet :: Uniquable a => a -> UniqSet a #

mkUniqSet :: Uniquable a => [a] -> UniqSet a #

addOneToUniqSet :: Uniquable a => UniqSet a -> a -> UniqSet a #

addListToUniqSet :: Uniquable a => UniqSet a -> [a] -> UniqSet a #

delOneFromUniqSet :: Uniquable a => UniqSet a -> a -> UniqSet a #

delOneFromUniqSet_Directly :: UniqSet a -> Unique -> UniqSet a #

delListFromUniqSet :: Uniquable a => UniqSet a -> [a] -> UniqSet a #

delListFromUniqSet_Directly :: UniqSet a -> [Unique] -> UniqSet a #

unionUniqSets :: UniqSet a -> UniqSet a -> UniqSet a #

unionManyUniqSets :: [UniqSet a] -> UniqSet a #

minusUniqSet :: UniqSet a -> UniqSet a -> UniqSet a #

uniqSetMinusUFM :: UniqSet key -> UniqFM key b -> UniqSet key #

uniqSetMinusUDFM :: UniqSet key -> UniqDFM key b -> UniqSet key #

intersectUniqSets :: UniqSet a -> UniqSet a -> UniqSet a #

disjointUniqSets :: UniqSet a -> UniqSet a -> Bool #

restrictUniqSetToUFM :: UniqSet key -> UniqFM key b -> UniqSet key #

uniqSetAny :: (a -> Bool) -> UniqSet a -> Bool #

uniqSetAll :: (a -> Bool) -> UniqSet a -> Bool #

elementOfUniqSet :: Uniquable a => a -> UniqSet a -> Bool #

elemUniqSet_Directly :: Unique -> UniqSet a -> Bool #

filterUniqSet :: (a -> Bool) -> UniqSet a -> UniqSet a #

filterUniqSet_Directly :: (Unique -> elt -> Bool) -> UniqSet elt -> UniqSet elt #

sizeUniqSet :: UniqSet a -> Int #

isEmptyUniqSet :: UniqSet a -> Bool #

lookupUniqSet :: Uniquable key => UniqSet key -> key -> Maybe key #

What's the point you might ask? We might have changed an object without it's key changing. In which case this lookup makes sense.

lookupUniqSet_Directly :: UniqSet a -> Unique -> Maybe a #

partitionUniqSet :: (a -> Bool) -> UniqSet a -> (UniqSet a, UniqSet a) #

mapUniqSet :: Uniquable b => (a -> b) -> UniqSet a -> UniqSet b #

unsafeUFMToUniqSet :: UniqFM a a -> UniqSet a #

`unsafeUFMToUniqSet` converts a ``UniqFM` a` into a ``UniqSet` a` assuming, without checking, that it maps each `Unique` to a value that has that `Unique`. See Note [UniqSet invariant].

nonDetEltsUniqSet :: UniqSet elt -> [elt] #

nonDetKeysUniqSet :: UniqSet elt -> [Unique] #

nonDetStrictFoldUniqSet :: (elt -> a -> a) -> a -> UniqSet elt -> a #

mapMaybeUniqSet_sameUnique :: (a -> Maybe b) -> UniqSet a -> UniqSet b #

Like `mapMaybe`, but you must ensure the passed in function does not change the `Unique`.

newtype UniqueSet #

Set of Unique values

Similar to 'UniqSet Unique' but with a more compact representation.

Constructors

US |
Fields unUniqueSet :: Word64Set

#### Instances

Instances details

Monoid UniqueSet # |
Instance details Defined in GHC.Types.Unique.Set Methods mempty :: UniqueSet # mappend :: UniqueSet -> UniqueSet -> UniqueSet # mconcat :: [UniqueSet] -> UniqueSet #
Semigroup UniqueSet # |
Instance details Defined in GHC.Types.Unique.Set Methods (<>) :: UniqueSet -> UniqueSet -> UniqueSet # sconcat :: NonEmpty UniqueSet -> UniqueSet # stimes :: Integral b => b -> UniqueSet -> UniqueSet #
Show UniqueSet # |
Instance details Defined in GHC.Types.Unique.Set Methods showsPrec :: Int -> UniqueSet -> ShowS # show :: UniqueSet -> String # showList :: [UniqueSet] -> ShowS #
Eq UniqueSet # |
Instance details Defined in GHC.Types.Unique.Set Methods (==) :: UniqueSet -> UniqueSet -> Bool # (/=) :: UniqueSet -> UniqueSet -> Bool #
Ord UniqueSet # |
Instance details Defined in GHC.Types.Unique.Set Methods compare :: UniqueSet -> UniqueSet -> Ordering # (<) :: UniqueSet -> UniqueSet -> Bool # (<=) :: UniqueSet -> UniqueSet -> Bool # (>) :: UniqueSet -> UniqueSet -> Bool # (>=) :: UniqueSet -> UniqueSet -> Bool # max :: UniqueSet -> UniqueSet -> UniqueSet # min :: UniqueSet -> UniqueSet -> UniqueSet #

nullUniqueSet :: UniqueSet -> Bool #

sizeUniqueSet :: UniqueSet -> Int #

memberUniqueSet :: Unique -> UniqueSet -> Bool #

emptyUniqueSet :: UniqueSet #

singletonUniqueSet :: Unique -> UniqueSet #

insertUniqueSet :: Unique -> UniqueSet -> UniqueSet #

deleteUniqueSet :: Unique -> UniqueSet -> UniqueSet #

differenceUniqueSet :: UniqueSet -> UniqueSet -> UniqueSet #

unionUniqueSet :: UniqueSet -> UniqueSet -> UniqueSet #

unionsUniqueSet :: [UniqueSet] -> UniqueSet #

intersectionUniqueSet :: UniqueSet -> UniqueSet -> UniqueSet #

isSubsetOfUniqueSet :: UniqueSet -> UniqueSet -> Bool #

filterUniqueSet :: (Unique -> Bool) -> UniqueSet -> UniqueSet #

foldlUniqueSet :: (a -> Unique -> a) -> a -> UniqueSet -> a #

foldrUniqueSet :: (Unique -> b -> b) -> b -> UniqueSet -> b #

elemsUniqueSet :: UniqueSet -> [Unique] #

fromListUniqueSet :: [Unique] -> UniqueSet #