UniqFM

ghc-8.4.4: The GHC API

Safe Haskell | None
Language | Haskell2010

UniqFM

Contents

- Unique-keyed mappings
  - Manipulating those mappings

Synopsis

- data UniqFM ele
- emptyUFM :: UniqFM elt
- unitUFM :: Uniquable key => key -> elt -> UniqFM elt
- unitDirectlyUFM :: Unique -> elt -> UniqFM elt
- listToUFM :: Uniquable key => [(key, elt)] -> UniqFM elt
- listToUFM_Directly :: [(Unique, elt)] -> UniqFM elt
- listToUFM_C :: Uniquable key => (elt -> elt -> elt) -> [(key, elt)] -> UniqFM elt
- addToUFM :: Uniquable key => UniqFM elt -> key -> elt -> UniqFM elt
- addToUFM_C :: Uniquable key => (elt -> elt -> elt) -> UniqFM elt -> key -> elt -> UniqFM elt
- addToUFM_Acc :: Uniquable key => (elt -> elts -> elts) -> (elt -> elts) -> UniqFM elts -> key -> elt -> UniqFM elts
- addListToUFM :: Uniquable key => UniqFM elt -> [(key, elt)] -> UniqFM elt
- addListToUFM_C :: Uniquable key => (elt -> elt -> elt) -> UniqFM elt -> [(key, elt)] -> UniqFM elt
- addToUFM_Directly :: UniqFM elt -> Unique -> elt -> UniqFM elt
- addListToUFM_Directly :: UniqFM elt -> [(Unique, elt)] -> UniqFM elt
- adjustUFM :: Uniquable key => (elt -> elt) -> UniqFM elt -> key -> UniqFM elt
- alterUFM :: Uniquable key => (Maybe elt -> Maybe elt) -> UniqFM elt -> key -> UniqFM elt
- adjustUFM_Directly :: (elt -> elt) -> UniqFM elt -> Unique -> UniqFM elt
- delFromUFM :: Uniquable key => UniqFM elt -> key -> UniqFM elt
- delFromUFM_Directly :: UniqFM elt -> Unique -> UniqFM elt
- delListFromUFM :: Uniquable key => UniqFM elt -> [key] -> UniqFM elt
- delListFromUFM_Directly :: UniqFM elt -> [Unique] -> UniqFM elt
- plusUFM :: UniqFM elt -> UniqFM elt -> UniqFM elt
- plusUFM_C :: (elt -> elt -> elt) -> UniqFM elt -> UniqFM elt -> UniqFM elt
- plusUFM_CD :: (elt -> elt -> elt) -> UniqFM elt -> elt -> UniqFM elt -> elt -> UniqFM elt
- plusMaybeUFM_C :: (elt -> elt -> Maybe elt) -> UniqFM elt -> UniqFM elt -> UniqFM elt
- plusUFMList :: [UniqFM elt] -> UniqFM elt
- minusUFM :: UniqFM elt1 -> UniqFM elt2 -> UniqFM elt1
- intersectUFM :: UniqFM elt1 -> UniqFM elt2 -> UniqFM elt1
- intersectUFM_C :: (elt1 -> elt2 -> elt3) -> UniqFM elt1 -> UniqFM elt2 -> UniqFM elt3
- disjointUFM :: UniqFM elt1 -> UniqFM elt2 -> Bool
- equalKeysUFM :: UniqFM a -> UniqFM b -> Bool
- nonDetFoldUFM :: (elt -> a -> a) -> a -> UniqFM elt -> a
- foldUFM :: (elt -> a -> a) -> a -> UniqFM elt -> a
- nonDetFoldUFM_Directly :: (Unique -> elt -> a -> a) -> a -> UniqFM elt -> a
- anyUFM :: (elt -> Bool) -> UniqFM elt -> Bool
- allUFM :: (elt -> Bool) -> UniqFM elt -> Bool
- seqEltsUFM :: ([elt] -> ()) -> UniqFM elt -> ()
- mapUFM :: (elt1 -> elt2) -> UniqFM elt1 -> UniqFM elt2
- mapUFM_Directly :: (Unique -> elt1 -> elt2) -> UniqFM elt1 -> UniqFM elt2
- elemUFM :: Uniquable key => key -> UniqFM elt -> Bool
- elemUFM_Directly :: Unique -> UniqFM elt -> Bool
- filterUFM :: (elt -> Bool) -> UniqFM elt -> UniqFM elt
- filterUFM_Directly :: (Unique -> elt -> Bool) -> UniqFM elt -> UniqFM elt
- partitionUFM :: (elt -> Bool) -> UniqFM elt -> (UniqFM elt, UniqFM elt)
- sizeUFM :: UniqFM elt -> Int
- isNullUFM :: UniqFM elt -> Bool
- lookupUFM :: Uniquable key => UniqFM elt -> key -> Maybe elt
- lookupUFM_Directly :: UniqFM elt -> Unique -> Maybe elt
- lookupWithDefaultUFM :: Uniquable key => UniqFM elt -> elt -> key -> elt
- lookupWithDefaultUFM_Directly :: UniqFM elt -> elt -> Unique -> elt
- nonDetEltsUFM :: UniqFM elt -> [elt]
- eltsUFM :: UniqFM elt -> [elt]
- nonDetKeysUFM :: UniqFM elt -> [Unique]
- ufmToSet_Directly :: UniqFM elt -> IntSet
- nonDetUFMToList :: UniqFM elt -> [(Unique, elt)]
- ufmToIntMap :: UniqFM elt -> IntMap elt
- pprUniqFM :: (a -> SDoc) -> UniqFM a -> SDoc
- pprUFM :: UniqFM a -> ([a] -> SDoc) -> SDoc
- pprUFMWithKeys :: UniqFM a -> ([(Unique, a)] -> SDoc) -> SDoc
- pluralUFM :: UniqFM a -> SDoc

# Unique-keyed mappings

data UniqFM ele #

Instances

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

## Manipulating those mappings

emptyUFM :: UniqFM elt #

unitUFM :: Uniquable key => key -> elt -> UniqFM elt #

unitDirectlyUFM :: Unique -> elt -> UniqFM elt #

listToUFM :: Uniquable key => [(key, elt)] -> UniqFM elt #

listToUFM_Directly :: [(Unique, elt)] -> UniqFM elt #

listToUFM_C :: Uniquable key => (elt -> elt -> elt) -> [(key, elt)] -> UniqFM elt #

addToUFM :: Uniquable key => UniqFM elt -> key -> elt -> UniqFM elt #

addToUFM_C :: Uniquable key => (elt -> elt -> elt) -> UniqFM elt -> key -> elt -> UniqFM elt #

addToUFM_Acc :: Uniquable key => (elt -> elts -> elts) -> (elt -> elts) -> UniqFM elts -> key -> elt -> UniqFM elts #

addListToUFM :: Uniquable key => UniqFM elt -> [(key, elt)] -> UniqFM elt #

addListToUFM_C :: Uniquable key => (elt -> elt -> elt) -> UniqFM elt -> [(key, elt)] -> UniqFM elt #

addToUFM_Directly :: UniqFM elt -> Unique -> elt -> UniqFM elt #

addListToUFM_Directly :: UniqFM elt -> [(Unique, elt)] -> UniqFM elt #

adjustUFM :: Uniquable key => (elt -> elt) -> UniqFM elt -> key -> UniqFM elt #

alterUFM :: Uniquable key => (Maybe elt -> Maybe elt) -> UniqFM elt -> key -> UniqFM elt #

adjustUFM_Directly :: (elt -> elt) -> UniqFM elt -> Unique -> UniqFM elt #

delFromUFM :: Uniquable key => UniqFM elt -> key -> UniqFM elt #

delFromUFM_Directly :: UniqFM elt -> Unique -> UniqFM elt #

delListFromUFM :: Uniquable key => UniqFM elt -> [key] -> UniqFM elt #

delListFromUFM_Directly :: UniqFM elt -> [Unique] -> UniqFM elt #

plusUFM :: UniqFM elt -> UniqFM elt -> UniqFM elt #

plusUFM_C :: (elt -> elt -> elt) -> UniqFM elt -> UniqFM elt -> UniqFM elt #

plusUFM_CD :: (elt -> elt -> elt) -> UniqFM elt -> elt -> UniqFM elt -> elt -> UniqFM elt #

`plusUFM_CD f m1 d1 m2 d2` merges the maps using `f` as the combinding function and `d1` resp. `d2` as the default value if there is no entry in `m1` reps. `m2`. The domain is the union of the domains of `m1` and `m2`.

Representative example:

    plusUFM_CD f {A: 1, B: 2} 23 {B: 3, C: 4} 42
       == {A: f 1 42, B: f 2 3, C: f 23 4 }

plusMaybeUFM_C :: (elt -> elt -> Maybe elt) -> UniqFM elt -> UniqFM elt -> UniqFM elt #

plusUFMList :: [UniqFM elt] -> UniqFM elt #

minusUFM :: UniqFM elt1 -> UniqFM elt2 -> UniqFM elt1 #

intersectUFM :: UniqFM elt1 -> UniqFM elt2 -> UniqFM elt1 #

intersectUFM_C :: (elt1 -> elt2 -> elt3) -> UniqFM elt1 -> UniqFM elt2 -> UniqFM elt3 #

disjointUFM :: UniqFM elt1 -> UniqFM elt2 -> Bool #

equalKeysUFM :: UniqFM a -> UniqFM b -> Bool #

nonDetFoldUFM :: (elt -> a -> a) -> a -> UniqFM elt -> a #

foldUFM :: (elt -> a -> a) -> a -> UniqFM elt -> a #

nonDetFoldUFM_Directly :: (Unique -> elt -> a -> a) -> a -> UniqFM elt -> a #

anyUFM :: (elt -> Bool) -> UniqFM elt -> Bool #

allUFM :: (elt -> Bool) -> UniqFM elt -> Bool #

seqEltsUFM :: ([elt] -> ()) -> UniqFM elt -> () #

mapUFM :: (elt1 -> elt2) -> UniqFM elt1 -> UniqFM elt2 #

mapUFM_Directly :: (Unique -> elt1 -> elt2) -> UniqFM elt1 -> UniqFM elt2 #

elemUFM :: Uniquable key => key -> UniqFM elt -> Bool #

elemUFM_Directly :: Unique -> UniqFM elt -> Bool #

filterUFM :: (elt -> Bool) -> UniqFM elt -> UniqFM elt #

filterUFM_Directly :: (Unique -> elt -> Bool) -> UniqFM elt -> UniqFM elt #

partitionUFM :: (elt -> Bool) -> UniqFM elt -> (UniqFM elt, UniqFM elt) #

sizeUFM :: UniqFM elt -> Int #

isNullUFM :: UniqFM elt -> Bool #

lookupUFM :: Uniquable key => UniqFM elt -> key -> Maybe elt #

lookupUFM_Directly :: UniqFM elt -> Unique -> Maybe elt #

lookupWithDefaultUFM :: Uniquable key => UniqFM elt -> elt -> key -> elt #

lookupWithDefaultUFM_Directly :: UniqFM elt -> elt -> Unique -> elt #

nonDetEltsUFM :: UniqFM elt -> [elt] #

eltsUFM :: UniqFM elt -> [elt] #

nonDetKeysUFM :: UniqFM elt -> [Unique] #

ufmToSet_Directly :: UniqFM elt -> IntSet #

nonDetUFMToList :: UniqFM elt -> [(Unique, elt)] #

ufmToIntMap :: UniqFM elt -> IntMap elt #

pprUniqFM :: (a -> SDoc) -> UniqFM a -> SDoc #

pprUFM #

Arguments

:: UniqFM a | The things to be pretty printed
-> ([a] -> 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.

pprUFMWithKeys #

Arguments

:: UniqFM a | The things to be pretty printed
-> ([(Unique, a)] -> 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 nonDetUFMToList.

pluralUFM :: UniqFM a -> SDoc #

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