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

Portabilityportable
Stabilityexperimental
MaintainerStefan Schmidt (stefanschmidt@web.de)

Holumbus.Data.AccuMap

Description

Version : 0.1

A map of key-value-pairs. The values are hold in a list, so adding the same key-value-pair twice to the map, will result in storing the value twice. Even the sequence of adding the values will be saved.

The name AccuMap is from accumulation map. You can use this map to easily storing all you key-value-pairs. After that you can all values-lists by key. Unlike the MultiMap, you don't lose the information of identical values and their order of adding.

Most functions are inspired by the Data.Map type.

Synopsis

Documentation

data AccuMap k a Source

the AccuMap datatype

Instances

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

empty :: Ord k => AccuMap k aSource

Creates an empty AccuMap.

null :: Ord k => AccuMap k a -> BoolSource

Test, if AccuMap is empty.

insert :: Ord k => k -> a -> AccuMap k a -> AccuMap k aSource

Insert a key-value-pair to the AccuMap.

insertList :: Ord k => k -> [a] -> AccuMap k a -> AccuMap k aSource

Insert a key and a list of values to the AccuMap. Faster than adding all pair one by one.

lookup :: Ord k => k -> AccuMap k a -> [a]Source

Get the list of values for one key. If the key doesn't exists, an empty list is returned.

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

Test, if the key is in the AccuMap.

deleteKey :: Ord k => k -> AccuMap k a -> AccuMap k aSource

Deletes a key and all its values from the AccuMap.

union :: Ord k => AccuMap k a -> AccuMap k a -> AccuMap k aSource

Combines two AccuMaps, the ordering of the two maps is significant for the order of the values-elements.

fromList :: Ord k => [(k, [a])] -> AccuMap k aSource

Creates an AccuMap from a list.

fromTupleList :: Ord k => [(k, a)] -> AccuMap k aSource

Creates an AccuMap from a tuple list.

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

Transforms an AccuMap to a list.