data-store-0.3.0.4: Type safe, in-memory dictionary with multidimensional keys.

Safe HaskellNone

Data.Store.Storable

Synopsis

Documentation

class Storable v whereSource

This type-class facilitates the common use case where the key under which given values is to be indexed can be derived from the value.

Example:

The Storable type-class instance for our Content data type would look like this:

 instance Storable Content where
     type StoreKRS Content = O         :. O      :. O      :. M      :. O 
     type StoreIRS Content = O         :. O      :. M      :. M      :. M
     type StoreTS  Content = ContentID :. String :. String :. String :. Double

     key (Content cn cb cts cr) = 
         S.dimA .: S.dimO cn .: S.dimO cb .: S.dimM cts .:. S.dimO cr

Associated Types

type StoreKRS t :: *Source

type StoreIRS t :: *Source

type StoreTS t :: *Source

Methods

key :: v -> Key (StoreKRS v) (StoreTS v)Source

insert :: Storable v => v -> Store tag (StoreKRS v) (StoreIRS v) (StoreTS v) v -> Maybe (RawKey (StoreKRS v) (StoreTS v), Store tag (StoreKRS v) (StoreIRS v) (StoreTS v) v)Source

See insert.

insert' :: Storable v => v -> Store tag (StoreKRS v) (StoreIRS v) (StoreTS v) v -> (RawKey (StoreKRS v) (StoreTS v), Store tag (StoreKRS v) (StoreIRS v) (StoreTS v) v)Source

See insert'.

updateWithKey :: (Storable v, IsSelection sel) => (RawKey (StoreKRS v) (StoreTS v) -> v -> Maybe v) -> sel tag (StoreKRS v) (StoreIRS v) (StoreTS v) -> Store tag (StoreKRS v) (StoreIRS v) (StoreTS v) v -> Maybe (Store tag (StoreKRS v) (StoreIRS v) (StoreTS v) v)Source

updateWithKey' :: (Storable v, IsSelection sel) => (RawKey (StoreKRS v) (StoreTS v) -> v -> Maybe v) -> sel tag (StoreKRS v) (StoreIRS v) (StoreTS v) -> Store tag (StoreKRS v) (StoreIRS v) (StoreTS v) v -> Store tag (StoreKRS v) (StoreIRS v) (StoreTS v) vSource

update :: (Storable v, IsSelection sel) => (v -> Maybe v) -> sel tag (StoreKRS v) (StoreIRS v) (StoreTS v) -> Store tag (StoreKRS v) (StoreIRS v) (StoreTS v) v -> Maybe (Store tag (StoreKRS v) (StoreIRS v) (StoreTS v) v)Source

See update.

update' :: (Storable v, IsSelection sel) => (v -> Maybe v) -> sel tag (StoreKRS v) (StoreIRS v) (StoreTS v) -> Store tag (StoreKRS v) (StoreIRS v) (StoreTS v) v -> Store tag (StoreKRS v) (StoreIRS v) (StoreTS v) vSource

See update'.

fromList :: (Empty (Index (StoreIRS v) (StoreTS v)), Storable v) => [v] -> Maybe (Store tag (StoreKRS v) (StoreIRS v) (StoreTS v) v)Source

See fromList.

fromList' :: (Empty (Index (StoreIRS v) (StoreTS v)), Storable v) => [v] -> Store tag (StoreKRS v) (StoreIRS v) (StoreTS v) vSource

See fromList'.