| Safe Haskell | None |
|---|---|
| Language | Haskell98 |
Hunt.Index.IndexImpl
Description
Heterogeneous indexes using ExistentialQuantification.
Indexes have to implement the Index type class as well as obey other constraints defined in
IndexImplCon.
Note: Due to the nature of ExistentialQuantification, deserialization is tricky because the
concrete implementation is not known.
This is circumvented by storing the type representation of the index. Deserialization is possible
if there is a matching type representation in the set of available types.
This requires the use of the custom get functions.
- type IndexImplCon i = (Index i, Show i, ICon i, IndexValue (IVal i), Binary i, Typeable i, IKey i ~ Text)
- data IndexImpl = forall i . IndexImplCon i => IndexImpl {
- ixImpl :: i
- gets' :: [IndexImpl] -> Get [(Context, IndexImpl)]
- get' :: [IndexImpl] -> Get IndexImpl
- mkIndex :: IndexImplCon i => i -> IndexImpl
Documentation
type IndexImplCon i = (Index i, Show i, ICon i, IndexValue (IVal i), Binary i, Typeable i, IKey i ~ Text) Source
Constraint for index implementations.
Index using ExistentialQuantification to allow heterogeneous index containers.
Constructors
| forall i . IndexImplCon i => IndexImpl | |
Fields
| |
gets' :: [IndexImpl] -> Get [(Context, IndexImpl)] Source
Deserialize a set of IndexImpls. Requires a set of available index implementations.
Note: This will fail if a used index implementation is not provided.
get' :: [IndexImpl] -> Get IndexImpl Source
Deserialize an IndexImpl. Requires a set of available index implementations.
Note: This will fail if a used index implementation is not provided.
mkIndex :: IndexImplCon i => i -> IndexImpl Source
Wrap an index using ExistentialQuantification to allow heterogeneous containers.