dawg-0.1.0: DAWG

Safe HaskellNone

Data.DAWG.VMap

Description

A vector representation of Map.

Synopsis

Documentation

data VMap a Source

A strictly ascending vector of distinct elements with respect to fst values.

Instances

(Eq a, Unbox a) => Eq (VMap a) 
(Eq (VMap a), Ord a, Unbox a) => Ord (VMap a) 
(Show a, Unbox a) => Show (VMap a) 
(Binary a, Unbox a) => Binary (VMap a) 

mkVMap :: Unbox a => [(Char, a)] -> VMap aSource

Smart VMap constructor which ensures that the underlying vector is strictly ascending with respect to fst values.

empty :: Unbox a => VMap aSource

Empty map.

lookup :: Unbox a => Char -> VMap a -> Maybe aSource

Lookup the character in the map.

insert :: Unbox a => Char -> a -> VMap a -> VMap aSource

Insert the (character, value) pair into the map. TODO: Optimize! Use the invariant, that VMap is kept in an ascending vector.