Safe Haskell | Safe-Infered |
---|
Implements multi-maps - maps that map keys to sets of values
This module uses the standard naming convention as other collection-like libraries and is meant to be imported qualified.
- newtype MultiMap k v = MultiMap {
- getMultiMap :: Map k (Set v)
- multiMap :: (Ord k, Ord v) => Map k (Set v) -> MultiMap k v
- multiMapL :: (Ord k, Ord v) => k -> Lens' (MultiMap k v) (Set v)
- lookup :: (Ord k, Ord v) => k -> MultiMap k v -> Set v
- member :: (Ord k, Ord v) => k -> MultiMap k v -> Bool
- findValue :: (Ord k, Ord v) => v -> MultiMap k v -> Maybe k
- elem :: (Ord k, Ord v) => v -> MultiMap k v -> Bool
- null :: MultiMap k v -> Bool
- insert :: (Ord k, Ord v) => k -> v -> MultiMap k v -> MultiMap k v
- fromList :: (Ord k, Ord v) => [(k, v)] -> MultiMap k v
- delete :: (Ord k, Ord v) => k -> v -> MultiMap k v -> MultiMap k v
- deleteAll :: (Ord k, Ord v) => k -> MultiMap k v -> MultiMap k v
- values :: (Ord k, Ord v) => MultiMap k v -> Set v
- multiMapValueL :: (Ord k, Ord v) => k -> v -> Lens' (MultiMap k v) Bool
Documentation
A multi-map that contains multiple values for a single key. It doesn't distinguish non-existent keys and keys with the empty set as the value.
MultiMap | |
|
multiMap :: (Ord k, Ord v) => Map k (Set v) -> MultiMap k vSource
Creates a multi-map from a map of sets.
multiMapL :: (Ord k, Ord v) => k -> Lens' (MultiMap k v) (Set v)Source
A Lens
that allows to access a set under a given key in a multi-map.
lookup :: (Ord k, Ord v) => k -> MultiMap k v -> Set vSource
Return the set corresponding to a given key.
member :: (Ord k, Ord v) => k -> MultiMap k v -> BoolSource
Tests if the given key has a non-empty set of values.
findValue :: (Ord k, Ord v) => v -> MultiMap k v -> Maybe kSource
Tries to find a key corresponding to a given value.
elem :: (Ord k, Ord v) => v -> MultiMap k v -> BoolSource
Returns True
iff a given value is present in a set of some key.
multiMapValueL :: (Ord k, Ord v) => k -> v -> Lens' (MultiMap k v) BoolSource
A Lens
that allows to access a given value/key pair in a multi-map.
It is similar to the At
instance, but uses more convenient Bool
instead of 'Maybe ()' and a pair key/value.