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

MaintainerStefan Schmidt (stefanschmidt@web.de)



Version : 0.1

The KeyMap is derived from the Data.Map type. The keys of the Map are strings and the values can be arbitrary data objects. But you don't have to specify the keys because every value-object is able to create it's own key via the Key typeclass.

From the functionality, the KeyMap stands between a set and a Map. If you want to insert an element to the map, it behaves like a set. You don't need an additionnal key and it makes no different if you insert an object multiple times. If you want to access the objects in the KeyMap, you can lookup them via the key, so in this case this container behaves like an ordinary map.

The functions for this container are named after the standard Map and Set functions.



data KeyMap a Source

The KeyMap datatype.


Eq a => Eq (KeyMap a) 
Ord a => Ord (KeyMap a) 
Show a => Show (KeyMap a) 

class Key n whereSource

Every element of this map has to implement a key-function. which gives us the key of the element


getKey :: n -> StringSource

empty :: KeyMap aSource

The empty KeyMap.

null :: Key a => KeyMap a -> BoolSource

Test, if the MultiMap is empty.

insert :: Key a => a -> KeyMap a -> KeyMap aSource

Inserts an element in the KeyMap.

lookup :: (Key a, Monad m) => String -> KeyMap a -> m aSource

Gets all different elements for one key or an empty set.

keys :: Key a => KeyMap a -> [String]Source

Get all different keys from the map.

elems :: Key a => KeyMap a -> [a]Source

Get all different values in the map without regarding their keys.

memberKey :: Key a => String -> KeyMap a -> BoolSource

Test, if a key is in the KeyMap.

memberElem :: Key a => a -> KeyMap a -> BoolSource

Test, if a data object is in the KeyMap.

deleteKey :: Key a => String -> KeyMap a -> KeyMap aSource

Deletes a whole key from the KeyMap.

deleteElem :: Key a => a -> KeyMap a -> KeyMap aSource

Deletes a single elemet from the KeyMap.

fromList :: Key a => [a] -> KeyMap aSource

Creates a KeyMap from a list of keys.

toList :: Key a => KeyMap a -> [a]Source

Transforms a KeyMap to a list of keys.

toAscList :: Key a => KeyMap a -> [a]Source

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