krisajenkins/elm-exts/25.7.0

NOTE: this package is not compatible with Elm 0.19.1

Exts.Dict

Extensions to the core Dict library.

indexBy : (v -> comparable) -> List v -> Dict comparable v

Turn a list of items into an indexed dictionary.

Supply an indexing function (eg. .id) and a list of items. indexBy returns a dictionary with each item stored under its index.

This code assumes each index is unique. If that is not the case, you should use groupBy instead.

groupBy : (v -> comparable) -> List v -> Dict comparable (List v)

Group a list of items by a key.

Supply an indexing function (eg. .id) and a list of items. groupBy returns a dictionary of group-key/list-of-items.

If the indexing function returns a unique key for every item, consider indexBy instead.

frequency : List comparable -> Dict comparable Int

Create a frequency-map from the given list.

getWithDefault : a -> comparable -> Dict comparable a -> a

Attempt to find a key, if it's not there, return a default value.

foldToList : (comparable -> v -> b) -> Dict comparable v -> List b

Run a function over the dictionary entries, resulting in a list of the final results.