blob: 29e815b3aedb0b09060bbf7e7f3c68e613f3084c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
module Utils.Json exposing
( dictDecoder
)
import Json.Decode as Decode exposing (Decoder)
import Dict exposing (Dict)
dictDecoder : Decoder comparable -> Decoder a -> Decoder (Dict comparable a)
dictDecoder keyDecoder valueDecoder =
Decode.map2 (,) keyDecoder valueDecoder
|> Decode.list
|> Decode.map Dict.fromList
|