Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data UniqFM key ele
- newtype NonDetUniqFM key ele = NonDetUniqFM {}
- emptyUFM :: UniqFM key elt
- unitUFM :: Uniquable key => key -> elt -> UniqFM key elt
- unitDirectlyUFM :: Unique -> elt -> UniqFM key elt
- zipToUFM :: Uniquable key => [key] -> [elt] -> UniqFM key elt
- listToUFM :: Uniquable key => [(key, elt)] -> UniqFM key elt
- listToUFM_Directly :: [(Unique, elt)] -> UniqFM key elt
- listToUFM_C :: Uniquable key => (elt -> elt -> elt) -> [(key, elt)] -> UniqFM key elt
- listToIdentityUFM :: Uniquable key => [key] -> UniqFM key key
- addToUFM :: Uniquable key => UniqFM key elt -> key -> elt -> UniqFM key elt
- addToUFM_C :: Uniquable key => (elt -> elt -> elt) -> UniqFM key elt -> key -> elt -> UniqFM key elt
- addToUFM_Acc :: Uniquable key => (elt -> elts -> elts) -> (elt -> elts) -> UniqFM key elts -> key -> elt -> UniqFM key elts
- addListToUFM :: Uniquable key => UniqFM key elt -> [(key, elt)] -> UniqFM key elt
- addListToUFM_C :: Uniquable key => (elt -> elt -> elt) -> UniqFM key elt -> [(key, elt)] -> UniqFM key elt
- addToUFM_Directly :: UniqFM key elt -> Unique -> elt -> UniqFM key elt
- addListToUFM_Directly :: UniqFM key elt -> [(Unique, elt)] -> UniqFM key elt
- adjustUFM :: Uniquable key => (elt -> elt) -> UniqFM key elt -> key -> UniqFM key elt
- alterUFM :: Uniquable key => (Maybe elt -> Maybe elt) -> UniqFM key elt -> key -> UniqFM key elt
- adjustUFM_Directly :: (elt -> elt) -> UniqFM key elt -> Unique -> UniqFM key elt
- delFromUFM :: Uniquable key => UniqFM key elt -> key -> UniqFM key elt
- delFromUFM_Directly :: UniqFM key elt -> Unique -> UniqFM key elt
- delListFromUFM :: Uniquable key => UniqFM key elt -> [key] -> UniqFM key elt
- delListFromUFM_Directly :: UniqFM key elt -> [Unique] -> UniqFM key elt
- plusUFM :: UniqFM key elt -> UniqFM key elt -> UniqFM key elt
- plusUFM_C :: (elt -> elt -> elt) -> UniqFM key elt -> UniqFM key elt -> UniqFM key elt
- plusUFM_CD :: (elta -> eltb -> eltc) -> UniqFM key elta -> elta -> UniqFM key eltb -> eltb -> UniqFM key eltc
- plusUFM_CD2 :: (Maybe elta -> Maybe eltb -> eltc) -> UniqFM key elta -> UniqFM key eltb -> UniqFM key eltc
- plusMaybeUFM_C :: (elt -> elt -> Maybe elt) -> UniqFM key elt -> UniqFM key elt -> UniqFM key elt
- plusUFMList :: [UniqFM key elt] -> UniqFM key elt
- minusUFM :: UniqFM key elt1 -> UniqFM key elt2 -> UniqFM key elt1
- intersectUFM :: UniqFM key elt1 -> UniqFM key elt2 -> UniqFM key elt1
- intersectUFM_C :: (elt1 -> elt2 -> elt3) -> UniqFM key elt1 -> UniqFM key elt2 -> UniqFM key elt3
- disjointUFM :: UniqFM key elt1 -> UniqFM key elt2 -> Bool
- equalKeysUFM :: UniqFM key a -> UniqFM key b -> Bool
- nonDetStrictFoldUFM :: (elt -> a -> a) -> a -> UniqFM key elt -> a
- foldUFM :: (elt -> a -> a) -> a -> UniqFM key elt -> a
- nonDetStrictFoldUFM_Directly :: (Unique -> elt -> a -> a) -> a -> UniqFM key elt -> a
- anyUFM :: (elt -> Bool) -> UniqFM key elt -> Bool
- allUFM :: (elt -> Bool) -> UniqFM key elt -> Bool
- seqEltsUFM :: ([elt] -> ()) -> UniqFM key elt -> ()
- mapUFM :: (elt1 -> elt2) -> UniqFM key elt1 -> UniqFM key elt2
- mapUFM_Directly :: (Unique -> elt1 -> elt2) -> UniqFM key elt1 -> UniqFM key elt2
- elemUFM :: Uniquable key => key -> UniqFM key elt -> Bool
- elemUFM_Directly :: Unique -> UniqFM key elt -> Bool
- filterUFM :: (elt -> Bool) -> UniqFM key elt -> UniqFM key elt
- filterUFM_Directly :: (Unique -> elt -> Bool) -> UniqFM key elt -> UniqFM key elt
- partitionUFM :: (elt -> Bool) -> UniqFM key elt -> (UniqFM key elt, UniqFM key elt)
- sizeUFM :: UniqFM key elt -> Int
- isNullUFM :: UniqFM key elt -> Bool
- lookupUFM :: Uniquable key => UniqFM key elt -> key -> Maybe elt
- lookupUFM_Directly :: UniqFM key elt -> Unique -> Maybe elt
- lookupWithDefaultUFM :: Uniquable key => UniqFM key elt -> elt -> key -> elt
- lookupWithDefaultUFM_Directly :: UniqFM key elt -> elt -> Unique -> elt
- nonDetEltsUFM :: UniqFM key elt -> [elt]
- eltsUFM :: UniqFM key elt -> [elt]
- nonDetKeysUFM :: UniqFM key elt -> [Unique]
- ufmToSet_Directly :: UniqFM key elt -> IntSet
- nonDetUFMToList :: UniqFM key elt -> [(Unique, elt)]
- ufmToIntMap :: UniqFM key elt -> IntMap elt
- unsafeIntMapToUFM :: IntMap elt -> UniqFM key elt
- unsafeCastUFMKey :: UniqFM key1 elt -> UniqFM key2 elt
- pprUniqFM :: (a -> SDoc) -> UniqFM key a -> SDoc
- pprUFM :: UniqFM key a -> ([a] -> SDoc) -> SDoc
- pprUFMWithKeys :: UniqFM key a -> ([(Unique, a)] -> SDoc) -> SDoc
- pluralUFM :: UniqFM key a -> SDoc
Unique-keyed mappings
A finite map from uniques
of one type to
elements in another type.
The key is just here to keep us honest. It's always safe to use a single type as key. If two types don't overlap in their uniques it's also safe to index the same map at multiple key types. But this is very much discouraged.
Instances
Functor (UniqFM key) # | |
(Data key, Data ele) => Data (UniqFM key ele) # | |
Defined in GHC.Types.Unique.FM gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> UniqFM key ele -> c (UniqFM key ele) Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (UniqFM key ele) Source # toConstr :: UniqFM key ele -> Constr Source # dataTypeOf :: UniqFM key ele -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (UniqFM key ele)) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (UniqFM key ele)) Source # gmapT :: (forall b. Data b => b -> b) -> UniqFM key ele -> UniqFM key ele Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UniqFM key ele -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UniqFM key ele -> r Source # gmapQ :: (forall d. Data d => d -> u) -> UniqFM key ele -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> UniqFM key ele -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> UniqFM key ele -> m (UniqFM key ele) Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> UniqFM key ele -> m (UniqFM key ele) Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> UniqFM key ele -> m (UniqFM key ele) Source # | |
Monoid (UniqFM key a) # | |
Semigroup (UniqFM key a) # | |
Outputable a => Outputable (UniqFM key a) # | |
Eq ele => Eq (UniqFM key ele) # | |
newtype NonDetUniqFM key ele Source #
A wrapper around UniqFM
with the sole purpose of informing call sites
that the provided Foldable
and Traversable
instances are
nondeterministic.
If you use this please provide a justification why it doesn't introduce
nondeterminism.
See Note [Deterministic UniqFM] in GHC.Types.Unique.DFM to learn about determinism.
Instances
Foldable (NonDetUniqFM key) # | Inherently nondeterministic. If you use this please provide a justification why it doesn't introduce nondeterminism. See Note [Deterministic UniqFM] in GHC.Types.Unique.DFM to learn about determinism. |
Defined in GHC.Types.Unique.FM fold :: Monoid m => NonDetUniqFM key m -> m Source # foldMap :: Monoid m => (a -> m) -> NonDetUniqFM key a -> m Source # foldMap' :: Monoid m => (a -> m) -> NonDetUniqFM key a -> m Source # foldr :: (a -> b -> b) -> b -> NonDetUniqFM key a -> b Source # foldr' :: (a -> b -> b) -> b -> NonDetUniqFM key a -> b Source # foldl :: (b -> a -> b) -> b -> NonDetUniqFM key a -> b Source # foldl' :: (b -> a -> b) -> b -> NonDetUniqFM key a -> b Source # foldr1 :: (a -> a -> a) -> NonDetUniqFM key a -> a Source # foldl1 :: (a -> a -> a) -> NonDetUniqFM key a -> a Source # toList :: NonDetUniqFM key a -> [a] Source # null :: NonDetUniqFM key a -> Bool Source # length :: NonDetUniqFM key a -> Int Source # elem :: Eq a => a -> NonDetUniqFM key a -> Bool Source # maximum :: Ord a => NonDetUniqFM key a -> a Source # minimum :: Ord a => NonDetUniqFM key a -> a Source # sum :: Num a => NonDetUniqFM key a -> a Source # product :: Num a => NonDetUniqFM key a -> a Source # | |
Traversable (NonDetUniqFM key) # | Inherently nondeterministic. If you use this please provide a justification why it doesn't introduce nondeterminism. See Note [Deterministic UniqFM] in GHC.Types.Unique.DFM to learn about determinism. |
Defined in GHC.Types.Unique.FM traverse :: Applicative f => (a -> f b) -> NonDetUniqFM key a -> f (NonDetUniqFM key b) Source # sequenceA :: Applicative f => NonDetUniqFM key (f a) -> f (NonDetUniqFM key a) Source # mapM :: Monad m => (a -> m b) -> NonDetUniqFM key a -> m (NonDetUniqFM key b) Source # sequence :: Monad m => NonDetUniqFM key (m a) -> m (NonDetUniqFM key a) Source # | |
Functor (NonDetUniqFM key) # | |
Defined in GHC.Types.Unique.FM fmap :: (a -> b) -> NonDetUniqFM key a -> NonDetUniqFM key b Source # (<$) :: a -> NonDetUniqFM key b -> NonDetUniqFM key a Source # |
Manipulating those mappings
unitDirectlyUFM :: Unique -> elt -> UniqFM key elt Source #
listToUFM_Directly :: [(Unique, elt)] -> UniqFM key elt Source #
listToUFM_C :: Uniquable key => (elt -> elt -> elt) -> [(key, elt)] -> UniqFM key elt Source #
listToIdentityUFM :: Uniquable key => [key] -> UniqFM key key Source #
addToUFM_C :: Uniquable key => (elt -> elt -> elt) -> UniqFM key elt -> key -> elt -> UniqFM key elt Source #
addToUFM_Acc :: Uniquable key => (elt -> elts -> elts) -> (elt -> elts) -> UniqFM key elts -> key -> elt -> UniqFM key elts Source #
addListToUFM_C :: Uniquable key => (elt -> elt -> elt) -> UniqFM key elt -> [(key, elt)] -> UniqFM key elt Source #
Add elements to the map, combining existing values with inserted ones using the given function.
alterUFM :: Uniquable key => (Maybe elt -> Maybe elt) -> UniqFM key elt -> key -> UniqFM key elt Source #
plusUFM_CD :: (elta -> eltb -> eltc) -> UniqFM key elta -> elta -> UniqFM key eltb -> eltb -> UniqFM key eltc Source #
`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 }
plusUFM_CD2 :: (Maybe elta -> Maybe eltb -> eltc) -> UniqFM key elta -> UniqFM key eltb -> UniqFM key eltc Source #
`plusUFM_CD2 f m1 m2` merges the maps using f
as the combining
function. Unlike plusUFM_CD
, a missing value is not defaulted: it is
instead passed as Nothing
to f
. f
can never have both its arguments
be Nothing
.
`plusUFM_CD2 f m1 m2` is the same as `plusUFM_CD f (mapUFM Just m1) Nothing (mapUFM Just m2) Nothing`.
plusMaybeUFM_C :: (elt -> elt -> Maybe elt) -> UniqFM key elt -> UniqFM key elt -> UniqFM key elt Source #
plusUFMList :: [UniqFM key elt] -> UniqFM key elt Source #
intersectUFM_C :: (elt1 -> elt2 -> elt3) -> UniqFM key elt1 -> UniqFM key elt2 -> UniqFM key elt3 Source #
nonDetStrictFoldUFM :: (elt -> a -> a) -> a -> UniqFM key elt -> a Source #
nonDetStrictFoldUFM_Directly :: (Unique -> elt -> a -> a) -> a -> UniqFM key elt -> a Source #
seqEltsUFM :: ([elt] -> ()) -> UniqFM key elt -> () Source #
lookupWithDefaultUFM :: Uniquable key => UniqFM key elt -> elt -> key -> elt Source #
lookupWithDefaultUFM_Directly :: UniqFM key elt -> elt -> Unique -> elt Source #
nonDetEltsUFM :: UniqFM key elt -> [elt] Source #
nonDetKeysUFM :: UniqFM key elt -> [Unique] Source #
ufmToSet_Directly :: UniqFM key elt -> IntSet Source #
nonDetUFMToList :: UniqFM key elt -> [(Unique, elt)] Source #
ufmToIntMap :: UniqFM key elt -> IntMap elt Source #
unsafeIntMapToUFM :: IntMap elt -> UniqFM key elt Source #
unsafeCastUFMKey :: UniqFM key1 elt -> UniqFM key2 elt Source #
Cast the key domain of a UniqFM.
As long as the domains don't overlap in their uniques this is safe.
:: UniqFM key a | The things to be pretty printed |
-> ([a] -> SDoc) | The pretty printing function to use on the elements |
-> SDoc |
|
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.
:: UniqFM key a | The things to be pretty printed |
-> ([(Unique, a)] -> SDoc) | The pretty printing function to use on the elements |
-> SDoc |
|
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.