1module Dict.Ext exposing (fetch, fetchUnknown, unionFlipped)
2
3import Dict exposing (Dict)
4
5
6
7-- 🔱
8
9
10unionFlipped : Dict comparable v -> Dict comparable v -> Dict comparable v
11unionFlipped a b =
12 Dict.union b a
13
14
15fetch : comparable -> v -> Dict comparable v -> v
16fetch key default dict =
17 dict
18 |> Dict.get key
19 |> Maybe.withDefault default
20
21
22fetchUnknown : comparable -> Dict comparable String -> String
23fetchUnknown key dict =
24 fetch key "MISSING_VALUE" dict