quickset-0.1.0: Very fast and memory-compact query-only set and map structures

MaintainerErtugrul Soeylemez <es@ertes.de>
Safe HaskellNone

Data.QuickMap

Contents

Description

This module implements very fast and compact query-only maps.

Synopsis

QuickMap

data QuickMap k a Source

QuickMaps are maps from keys to values that use a compact unboxed vector as the internal representation. As such QuickMaps are always strict in both the keys and values.

Instances

Typeable2 QuickMap 
(Eq k, Eq a, Unbox k, Unbox a) => Eq (QuickMap k a) 
(Typeable (QuickMap k a), Data k, Data a, Unbox k, Unbox a) => Data (QuickMap k a) 
(Eq (QuickMap k a), Ord k, Ord a, Unbox k, Unbox a) => Ord (QuickMap k a) 
(Ord k, Read a, Read k, Unbox a, Unbox k) => Read (QuickMap k a) 
(Show a, Show k, Unbox a, Unbox k) => Show (QuickMap k a) 

Construction

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

Convert a list to a QuickMap.

fromListN :: (Ord k, Unbox a, Unbox k) => Int -> [(k, a)] -> QuickMap k aSource

Convert a prefix of the given length of the given list to a QuickMap.

fromVector :: (Ord k, Unbox a, Unbox k) => Vector (k, a) -> QuickMap k aSource

Convert an unboxed vector to a QuickMap.

Query

lookup :: (Ord k, Unbox a, Unbox k) => k -> QuickMap k a -> Maybe aSource

Try to look up a key.

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

Check whether the given key is in the map.