Safe Haskell | None |
---|---|
Language | Haskell2010 |
HashMap utilities
Documentation
mapFromVector :: (Eq k, Hashable k) => Vector v -> (Int -> v -> k) -> HashMap k v Source #
Creates a HashMap
from a Vector
Creates a HashMap
and fills it using the Vector
elements as
values and elements with key function as keys.
If key function returns duplicate keys for some elements, previous entry is replaced with a new one.
Arguments:
vec :: Vector v
: InputVector
keyfun :: (Int -> v -> k)
: Key function that takes an element index and element and returns the map key
Return value: HashMap
filled with elements from input Vector