Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
A SetMap allows the association of multiple values with a single key, but there are no duplicates per key.
- data SetMap k v
- null :: SetMap k a -> Bool
- size :: SetMap k a -> Int
- numKeys :: SetMap k a -> Word32
- numValues :: SetMap k a -> Word32
- member :: Ord k => SetMap k a -> k -> Bool
- notMember :: Ord k => SetMap k a -> k -> Bool
- lookup :: Ord k => k -> SetMap k a -> Set a
- (!) :: Ord k => SetMap k a -> k -> Set a
- empty :: SetMap k a
- insert :: (Ord k, Ord a) => k -> a -> SetMap k a -> SetMap k a
- delete :: Ord k => k -> SetMap k a -> SetMap k a
- map :: (Ord a, Ord b) => (a -> b) -> SetMap k a -> SetMap k b
- elems :: SetMap k a -> [[a]]
- keys :: SetMap k a -> [k]
- toMap :: SetMap k a -> Map k (Set a)
SetMap type
A SetMap with keys k
and values v
.
Query
numKeys :: SetMap k a -> Word32 Source
O(1). The number of keys in the multimap.
As this is a multimap, the number of keys is not necessarily equal to the number of values.
numValues :: SetMap k a -> Word32 Source
O(1). The number of values in the multimap.
As this is a multimap, the number of keys is not necessarily equal to the number of values.
notMember :: Ord k => SetMap k a -> k -> Bool Source
O(log n). Is the key not a member of the multimap?
lookup :: Ord k => k -> SetMap k a -> Set a Source
O(log n). Lookup the value at a key in the map.
The function will return the corrsponding values as a List, or the empty list if no values are associated witht the given key.
Operators
Construction
Insertion
insert :: (Ord k, Ord a) => k -> a -> SetMap k a -> SetMap k a Source
Insert a new key and value in the map.
Deletion
delete :: Ord k => k -> SetMap k a -> SetMap k a Source
Delete a key and all its values from the map.
Traversal
map :: (Ord a, Ord b) => (a -> b) -> SetMap k a -> SetMap k b Source
Map a function over all values in the map.