PrimitiveArray-0.10.1.0: Efficient multidimensional arrays
Safe HaskellNone
LanguageHaskell2010

Data.PrimitiveArray.HashTable

Description

A table representation that internally uses a hashtable from the hashtables library. The implementation is currently a testbed on which idea makes the most sense.

In particular, once a hashtable has been created with, say, newWithPA, it will be completely void of any entries. To prime the system, call setValidKeys which will setup all keys that are vaild, as well as setup an additional data structure to help with streamUp and streamDown.

This table does not store default values, since it is assumed that lookups are only done on valid keys, and ADPfusion as the default consumer should have rules "jump over" missing keys.

Currently the idea is that any write to an undeclared key will just fail SILENTLY!

TODO this also forces rethinking inBounds, as this will now depend on the internal structure given via setValidKeys.

Synopsis

Documentation

data Hashed ht sh e Source #

Constructors

Hashed 

Fields

setValidKeys :: (PrimMonad m, HashTable h) => LimitType sh -> h (PrimState m) k v -> m (Hashed ht sh e) Source #

Sets valid keys, working within a primitive Monad. The valid keys should be a hashtable with all correct keys, but values set to something resembling a default value. A good choice will be akin to mzero.

Internally, this function uses unsafeCoerce to change the PrimState token held by the hash table to RealWord, from whatever it is.

TODO setup the hashedUpDown part, once it is clear what to do.