Open Herteby opened 5 years ago
Like dict2, but keyValuePairs2
?
If so, wouldn’t (String -> Decoder k) -> Decoder v -> Decoder (List ( k, v ))
make more sense? I’m thinking it is strange to ask for a decoder for the keys when we know that only Json.Decode.string
would ever succeed (since object keys are always strings). See also: https://github.com/elm-community/json-extra/issues/22#issuecomment-544285606
@lydell True, String -> Decoder k
would work, although it looks a bit odd I think.
How about String -> Maybe k
or String -> Result String k
?
Would be nice to have a key-value decoder that allowed you to specify the key decoder, instead of it always being
String
:slightly_smiling_face:Useful when using wrapped types like
type ID = ID String