Portability | portable |
---|---|
Stability | experimental |
Maintainer | Stefan Schmidt (stefanschmidt@web.de) |
Version : 0.1
This module provides a MultiMap, that means a Map, which can hold multiple values for one key, but every distinct value is only stores once. So adding the same key-value-pair twice will only create one new entry in the map.
This Map is helpfull to examine how many different key-values-pairs you have in your application.
Most of the functions are borrowed from Data.Map
- data MultiMap k a
- empty :: (Ord k, Ord a) => MultiMap k a
- null :: (Ord k, Ord a) => MultiMap k a -> Bool
- insert :: (Ord k, Ord a) => k -> a -> MultiMap k a -> MultiMap k a
- insertSet :: (Ord k, Ord a) => k -> Set a -> MultiMap k a -> MultiMap k a
- insertKeys :: (Ord k, Ord a) => [k] -> Set a -> MultiMap k a -> MultiMap k a
- lookup :: (Ord k, Ord a) => k -> MultiMap k a -> Set a
- keys :: (Ord k, Ord a) => MultiMap k a -> Set k
- elems :: (Ord k, Ord a) => MultiMap k a -> Set a
- filterElements :: (Ord k, Ord a) => [k] -> MultiMap k a -> Set a
- member :: (Ord k, Ord a) => k -> MultiMap k a -> Bool
- delete :: (Ord k, Ord a) => k -> Maybe a -> MultiMap k a -> MultiMap k a
- deleteKey :: (Ord k, Ord a) => k -> MultiMap k a -> MultiMap k a
- deleteElem :: (Ord k, Ord a) => k -> a -> MultiMap k a -> MultiMap k a
- deleteAllElems :: (Ord k, Ord a) => a -> MultiMap k a -> MultiMap k a
- fromList :: (Ord k, Ord a) => [(k, Set a)] -> MultiMap k a
- fromTupleList :: (Ord k, Ord a) => [(k, a)] -> MultiMap k a
- toList :: (Ord k, Ord a) => MultiMap k a -> [(k, Set a)]
- toAscList :: (Ord k, Ord a) => MultiMap k a -> [(k, Set a)]
Documentation
A MultiMap, it can hold more (different!!!) Elements for one key.
insert :: (Ord k, Ord a) => k -> a -> MultiMap k a -> MultiMap k aSource
Inserts an element in the MultiMap.
insertSet :: (Ord k, Ord a) => k -> Set a -> MultiMap k a -> MultiMap k aSource
Inserts multiple elements in a set to the MultiMap.
insertKeys :: (Ord k, Ord a) => [k] -> Set a -> MultiMap k a -> MultiMap k aSource
Inserts multiple keys with the same values.
lookup :: (Ord k, Ord a) => k -> MultiMap k a -> Set aSource
Gets all different elements for one key or an empty set.
elems :: (Ord k, Ord a) => MultiMap k a -> Set aSource
Get all different values in the map without regarding their keys.
filterElements :: (Ord k, Ord a) => [k] -> MultiMap k a -> Set aSource
Like lookup keys, but an empty input list will give all elements back, not the empty set.
delete :: (Ord k, Ord a) => k -> Maybe a -> MultiMap k a -> MultiMap k aSource
Deletes an Element from the Map, if the data in Nothing, the whole key is deleted.
deleteKey :: (Ord k, Ord a) => k -> MultiMap k a -> MultiMap k aSource
Deletes a whole key from the map.
deleteElem :: (Ord k, Ord a) => k -> a -> MultiMap k a -> MultiMap k aSource
Deletes a single Element from the map.
deleteAllElems :: (Ord k, Ord a) => a -> MultiMap k a -> MultiMap k aSource
Deletes all Elements (*,a) (slow!!!).
fromList :: (Ord k, Ord a) => [(k, Set a)] -> MultiMap k aSource
Creates a MultiMap from a list of pairs (key,set value).
fromTupleList :: (Ord k, Ord a) => [(k, a)] -> MultiMap k aSource
Creates a MultiMap from a list of tuples.