Holumbus-Distribution-0.1.1: intra- and inter-program communication

Portabilityportable
Stabilityexperimental
MaintainerStefan Schmidt (stefanschmidt@web.de)

Holumbus.Data.MultiMap

Description

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

Synopsis

Documentation

data MultiMap k a Source

A MultiMap, it can hold more (different!!!) Elements for one key.

Instances

(Eq k, Eq a) => Eq (MultiMap k a) 
(Ord k, Ord a) => Ord (MultiMap k a) 
(Show k, Show a) => Show (MultiMap k a) 

empty :: (Ord k, Ord a) => MultiMap k aSource

The empty MultiMap.

null :: (Ord k, Ord a) => MultiMap k a -> BoolSource

Test, if the MultiMap is empty.

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.

keys :: (Ord k, Ord a) => MultiMap k a -> Set kSource

Get all different keys from the map.

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.

member :: (Ord k, Ord a) => k -> MultiMap k a -> BoolSource

Test, if a key is in the Map.

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.

toList :: (Ord k, Ord a) => MultiMap k a -> [(k, Set a)]Source

Transforms a MultiMap to a list of pairs (key,set value).

toAscList :: (Ord k, Ord a) => MultiMap k a -> [(k, Set a)]Source

The same as toList, but the keys are in ascending order.