Copyright | [2020] Trevor L. McDonell |
---|---|
License | BSD3 |
Maintainer | Trevor L. McDonell <trevor.mcdonell@gmail.com> |
Stability | experimental |
Portability | non-portable (GHC extensions) |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- data HashMap k v
- class Elt a => Hashable a
- fromVector :: (Hashable k, Elt v) => Acc (Vector (k, v)) -> Acc (HashMap k v)
- size :: (Elt k, Elt v) => Acc (HashMap k v) -> Exp Int
- member :: (Eq k, Hashable k, Elt v) => Exp k -> Acc (HashMap k v) -> Exp Bool
- lookup :: (Eq k, Hashable k, Elt v) => Exp k -> Acc (HashMap k v) -> Exp (Maybe v)
- insert :: (Eq k, Hashable k, Elt v) => Acc (Vector (k, v)) -> Acc (HashMap k v) -> Acc (HashMap k v)
- insertWith :: (Eq k, Hashable k, Elt v) => (Exp v -> Exp v -> Exp v) -> Acc (Vector (k, v)) -> Acc (HashMap k v) -> Acc (HashMap k v)
- insertWithKey :: (Eq k, Hashable k, Elt v) => (Exp k -> Exp v -> Exp v -> Exp v) -> Acc (Vector (k, v)) -> Acc (HashMap k v) -> Acc (HashMap k v)
- delete :: (Eq k, Hashable k, Elt v) => Acc (Vector k) -> Acc (HashMap k v) -> Acc (HashMap k v)
- adjust :: (Eq k, Hashable k, Elt v) => (Exp v -> Exp v) -> Acc (Vector k) -> Acc (HashMap k v) -> Acc (HashMap k v)
- adjustWithKey :: (Eq k, Hashable k, Elt v) => (Exp k -> Exp v -> Exp v) -> Acc (Vector k) -> Acc (HashMap k v) -> Acc (HashMap k v)
- map :: (Elt k, Elt v1, Elt v2) => (Exp v1 -> Exp v2) -> Acc (HashMap k v1) -> Acc (HashMap k v2)
- mapWithKey :: (Elt k, Elt v1, Elt v2) => (Exp k -> Exp v1 -> Exp v2) -> Acc (HashMap k v1) -> Acc (HashMap k v2)
- keys :: (Elt k, Elt v) => Acc (HashMap k v) -> Acc (Vector k)
- elems :: (Elt k, Elt v) => Acc (HashMap k v) -> Acc (Vector v)
- assocs :: (Elt k, Elt v) => Acc (HashMap k v) -> Acc (Vector (k, v))
Documentation
A map from keys to values. The map can not contain duplicate keys.
Instances
(Elt k, Elt v, Show k, Show v) => Show (HashMap k v) Source # | |
Generic (HashMap k v) Source # | |
(Elt k, Elt v) => Arrays (HashMap k v) Source # | |
type Rep (HashMap k v) Source # | |
Defined in Data.Array.Accelerate.Data.HashMap | |
type ArraysR (HashMap k v) Source # | |
Defined in Data.Array.Accelerate.Data.HashMap |
The class of types that can be converted to a hash value.
Instances
Construction
fromVector :: (Hashable k, Elt v) => Acc (Vector (k, v)) -> Acc (HashMap k v) Source #
O(n log n) Construct a map from the supplied (key,value) pairs
Basic interface
size :: (Elt k, Elt v) => Acc (HashMap k v) -> Exp Int Source #
O(1) Return the number of key-value mappings
lookup :: (Eq k, Hashable k, Elt v) => Exp k -> Acc (HashMap k v) -> Exp (Maybe v) Source #
O(k) Return the value to which the specified key is mapped, or
Nothing
if the map contains no mapping for the key.
insert :: (Eq k, Hashable k, Elt v) => Acc (Vector (k, v)) -> Acc (HashMap k v) -> Acc (HashMap k v) Source #
Insert new (key,value) pairs into the map. If the key is already present in the map, the associated value is replaced with the supplied value.
insertWith :: (Eq k, Hashable k, Elt v) => (Exp v -> Exp v -> Exp v) -> Acc (Vector (k, v)) -> Acc (HashMap k v) -> Acc (HashMap k v) Source #
Insert with a function combining the new value and old value. Each pair will be inserted into the map if the key does not already exist. If the key exists, the pair '(key, f new_value old_value)' will be inserted.
insertWithKey :: (Eq k, Hashable k, Elt v) => (Exp k -> Exp v -> Exp v -> Exp v) -> Acc (Vector (k, v)) -> Acc (HashMap k v) -> Acc (HashMap k v) Source #
O(n log n) Insert values into the map using a function to combine the new value and old value. Each pair will be inserted into the map if the key does not already exist. If the key exists, the pair '(key, f key new_value old_value)' will be inserted.
delete :: (Eq k, Hashable k, Elt v) => Acc (Vector k) -> Acc (HashMap k v) -> Acc (HashMap k v) Source #
Delete a key and its value from the map. When the key is not a member of the map, that key is ignored
adjust :: (Eq k, Hashable k, Elt v) => (Exp v -> Exp v) -> Acc (Vector k) -> Acc (HashMap k v) -> Acc (HashMap k v) Source #
Update a value at a specific key using the provided function. When the key is not a member of the map, that key is ignored.
adjustWithKey :: (Eq k, Hashable k, Elt v) => (Exp k -> Exp v -> Exp v) -> Acc (Vector k) -> Acc (HashMap k v) -> Acc (HashMap k v) Source #
Update a value at a specific key using the provided function. When the key is not a member of the map, that key is ignored.
Transformations
map :: (Elt k, Elt v1, Elt v2) => (Exp v1 -> Exp v2) -> Acc (HashMap k v1) -> Acc (HashMap k v2) Source #
O(n) Transform the map by applying a function to every value
mapWithKey :: (Elt k, Elt v1, Elt v2) => (Exp k -> Exp v1 -> Exp v2) -> Acc (HashMap k v1) -> Acc (HashMap k v2) Source #
O(n) Transform this map by applying a function to every value