Open malaire opened 5 years ago
dict2
tries to parse the keys as JSON here for some reason:
1
is valid JSON, hello
is not.
Maybe the signature of dict2
should be changed to:
dict2 : (String -> Decoder comparable) -> Decoder v -> Decoder (Dict comparable v)
-- with this:
case decodeValue (keyDecoder strKey) (Json.Encode.string strKey) of
If so, the dict2 int string
example would become dict2 (String.toInt >> fromMaybe) string
, and your dict2 string string
example would become dict2 succeed string
.
If one wants the current behavior, that can be done with dict2 (always (doubleEncoded keyDecoder)) valueDecoder
.
This example
gives following error: