Copyright | (c) Galois Inc 2014 |
---|---|
Maintainer | Joe Hendrix <jhendrix@galois.com> |
Safe Haskell | Trustworthy |
Language | Haskell98 |
This module provides a ST-based hashtable for parameterized keys and values.
NOTE: This API makes use of unsafeCoerce to implement the parameterized
hashtable abstraction. This should be typesafe provided the
TestEquality
instance on the key type is implemented soundly.
- data HashTable s (key :: k -> *) (val :: k -> *)
- new :: ST s (HashTable s key val)
- newSized :: Int -> ST s (HashTable s k v)
- clone :: (HashableF key, TestEquality key) => HashTable s key val -> ST s (HashTable s key val)
- lookup :: (HashableF key, TestEquality key) => HashTable s key val -> key tp -> ST s (Maybe (val tp))
- insert :: (HashableF key, TestEquality key) => HashTable s (key :: k -> *) (val :: k -> *) -> key tp -> val tp -> ST s ()
- member :: (HashableF key, TestEquality key) => HashTable s (key :: k -> *) (val :: k -> *) -> key (tp :: k) -> ST s Bool
- delete :: (HashableF key, TestEquality key) => HashTable s (key :: k -> *) (val :: k -> *) -> key (tp :: k) -> ST s ()
- clear :: (HashableF key, TestEquality key) => HashTable s (key :: k -> *) (val :: k -> *) -> ST s ()
- class HashableF (f :: k -> *) where
- data RealWorld :: *
Documentation
clone :: (HashableF key, TestEquality key) => HashTable s key val -> ST s (HashTable s key val) Source #
Create a hash table that is a copy of the current one.
lookup :: (HashableF key, TestEquality key) => HashTable s key val -> key tp -> ST s (Maybe (val tp)) Source #
Lookup value of key in table.
insert :: (HashableF key, TestEquality key) => HashTable s (key :: k -> *) (val :: k -> *) -> key tp -> val tp -> ST s () Source #
Insert new key and value mapping into table.
member :: (HashableF key, TestEquality key) => HashTable s (key :: k -> *) (val :: k -> *) -> key (tp :: k) -> ST s Bool Source #
Return true if the key is in the hash table.
delete :: (HashableF key, TestEquality key) => HashTable s (key :: k -> *) (val :: k -> *) -> key (tp :: k) -> ST s () Source #
Delete an element from the hash table.
clear :: (HashableF key, TestEquality key) => HashTable s (key :: k -> *) (val :: k -> *) -> ST s () Source #
class HashableF (f :: k -> *) where Source #
A parameterized type that is hashable on all instances.
HashableF Nat NatRepr Source # | |
HashableF Symbol SymbolRepr Source # | |
HashableF k (Nonce k) Source # | |
Hashable a => HashableF k (Const k a) Source # | |
HashableF k (Nonce k s) Source # | |
HashableF k (Index k ctx) Source # | |
HashableF k (Index k ctx) Source # | |
HashableF k f => HashableF (Ctx k) (Assignment k f) Source # | |
HashableF k f => HashableF (Ctx k) (Assignment k f) Source # | |