This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
README

ListMap

An Elm package that implements a key value store a a simple List of pairs. Although this is horribly inefficient, it allows you to have any values as the key without having to worry about implementing comparators or hash functions.

Useful if you know that you aren't going to have a very long list.

type alias ListMap key value = List (key, value)

The ListMap type with a specified key and value. The key can be any type.

empty : ListMap key value

Return an empty ListMap

get : key -> ListMap key value -> Maybe value

Look for the given key in the ListMap. If the key can't be found this returns Nothing.

set : key -> value -> ListMap key value -> ListMap key value

Replace or insert the given key value and return the updated ListMap.

module ListMap exposing
  ( ListMap
  , empty
  , get
  , set
  )

{-| An Elm package that implements a key value store a a simple `List` of pairs.  Although this is horribly
inefficient, it allows you to have any values as the key without having to worry about implementing
comparators or hash functions.

Useful if you know that you aren't going to have a very long list.

@docs ListMap, empty, get, set
-}

import List.Extra exposing (find, dropWhile)


{-| The ListMap type with a specified key and value.  The key can be any type.
-}
type alias ListMap key value =
  List (key, value)


{-| Return an empty ListMap
-}
empty : ListMap key value
empty =
  []


{-| Look for the given key in the ListMap.  If the key can't be found this returns
Nothing.
-}
get : key -> ListMap key value -> Maybe value
get key listMap =
  listMap
    |> find (\(k, _) -> k == key)
    |> Maybe.map snd


{-| Replace or insert the given key value and return the updated ListMap.
-}
set : key -> value -> ListMap key value -> ListMap key value
set key value listMap =
  listMap
    |> dropWhile (\(k, _) -> k == key)
    |> (::) (key, value)