Safe Haskell | None |
---|
- data Table t k v
- data Set t a
- data HashRefSet t a
- data MultiTable t k s
- data Sized c
- type Basic = HashTable
- type Cuckoo = HashTable
- type Linear = HashTable
- type Key k = (Hashable k, Eq k)
- type family Row c
- type family UniqueKey c
- type family MultiKey c
- type family Value c
- class Collection c where
- class Collection c => Lookup c where
- class Collection c => LookupMulti c where
- lookupMulti :: c -> MultiKey c -> IO [Value c]
- class Collection c => Elem c where
- class Collection c => Insert c where
- class Collection c => Delete c where
- class Collection c => Size c where
- class Collection c => Null c where
- forM_ :: Collection c => c -> (Row c -> IO ()) -> IO ()
- toList :: Collection c => c -> IO [Row c]
Data Structures
data HashRefSet t a Source
A specialized set of HashRef
s.
t
is the underlying HashTable
implementation,
a
is the item.
E.g.:
type LinearHashRefSet a =HashRefSet
Linear
a
HashTable t => Delete (HashRefSet t a) | |
HashTable t => Insert (HashRefSet t a) | |
HashTable t => Elem (HashRefSet t a) | |
HashTable t => Collection (HashRefSet t a) |
data MultiTable t k s Source
A multitable (or multimap) with underlying HashTable
t
, key k
and
a set implementation s
.
E.g.:
type BasicMultiTable k v =MultiTable
Basic
k (Set
Basic
v)
If a Sized
implementation of set is specified,
a more space efficient instance of Delete
will be used. E.g.:
MultiTable Basic k (Sized
(Set Basic v))
(HashTable t, Key k, Delete c) => Delete (MultiTable t k (Sized c)) | |
(HashTable t, Key k, Delete c) => Delete (MultiTable t k c) | |
(HashTable t, Key k, Insert s) => Insert (MultiTable t k s) | |
(HashTable t, Key k, Elem s) => Elem (MultiTable t k s) | |
(HashTable t, Key k, Collection s, ~ * (Value s) (Row s)) => LookupMulti (MultiTable t k s) | |
(HashTable t, Key k, Collection s) => Collection (MultiTable t k s) |
A wrapper over a Collection
,
which adds null
and size
functions of O(1) complexity.
E.g.:
type SizedLinearTable k v =Sized
(Table
Linear
k v)
Collection c => Null (Sized c) | |
Collection c => Size (Sized c) | |
Delete c => Delete (Sized c) | |
Insert c => Insert (Sized c) | |
Elem c => Elem (Sized c) | |
LookupMulti c => LookupMulti (Sized c) | |
Lookup c => Lookup (Sized c) | |
Collection c => Collection (Sized c) | |
(HashTable t, Key k, Delete c) => Delete (MultiTable t k (Sized c)) |
HashTable Implementations
These are aliases of implementations of a class HashTable
,
which provide different performance and memory consumption characteristics.
They are used as parameters to data structures.
For more info refer to the documentation on aliased types.
Interface
A row of a collection. For tables and multitables it's a key-value pair, for sets it's just the item.
type family UniqueKey c Source
A unique row identifier. For tables it's a key, for multitables it's a key-value pair, for sets it's the item itself.
A non-unique row identifier. For tables and sets there is none, for multitables it's a key.
An item of a collection. For tables and multitables it's a value (from the key-value pair), for sets it's the item.
class Collection c whereSource
Create a new collection.
foldM :: c -> r -> (r -> Row c -> IO r) -> IO rSource
Strictly fold over the rows.
Collection c => Collection (Sized c) | |
HashTable t => Collection (HashRefSet t a) | |
(HashTable t, Key a) => Collection (Set t a) | |
(HashTable t, Key k, Collection s) => Collection (MultiTable t k s) | |
(HashTable t, Key k) => Collection (Table t k v) |
class Collection c => Lookup c whereSource
class Collection c => LookupMulti c whereSource
lookupMulti :: c -> MultiKey c -> IO [Value c]Source
Lookup multiple items by a non-unique key.
LookupMulti c => LookupMulti (Sized c) | |
(HashTable t, Key k, Collection s, ~ * (Value s) (Row s)) => LookupMulti (MultiTable t k s) |
class Collection c => Elem c whereSource
class Collection c => Insert c whereSource
class Collection c => Delete c whereSource
class Collection c => Size c whereSource
Collection c => Size (Sized c) |
class Collection c => Null c whereSource
Collection c => Null (Sized c) |
forM_ :: Collection c => c -> (Row c -> IO ()) -> IO ()Source
Traverse thru all the rows of a collection with side effects.
toList :: Collection c => c -> IO [Row c]Source
O(n). Convert a collection to a list.