vt-utils-1.3.0.0: Vector and Text utilities

Safe HaskellNone
LanguageHaskell2010

VtUtils.Map

Description

HashMap utilities

Synopsis

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: Input Vector
  • 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