We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I got the following error when decoding a big data structure:
RangeError: Maximum call stack size exceeded
I'm not sure if this repo is actively maintained so I won't bother creating a PR, but here is a tail recursive version of dict2 if anyone needs it:
dict2
dict2 : Decoder comparable -> Decoder v -> Decoder (Dict comparable v) dict2 keyDecoder valueDecoder = Decode.keyValuePairs valueDecoder |> Decode.andThen (decodeDictFromTuples keyDecoder) decodeDictFromTuples : Decoder comparable -> List ( String, v ) -> Decoder (Dict comparable v) decodeDictFromTuples keyDecoder tuples = let helper : List ( String, v ) -> Dict comparable v -> Decoder (Dict comparable v) helper remainingTuples dictAcc = case remainingTuples of [] -> Decode.succeed dictAcc ( strKey, value ) :: rest -> case Decode.decodeString keyDecoder strKey of Ok key -> helper rest (Dict.insert key value dictAcc) Err error -> Decode.fail (Decode.errorToString error) in helper tuples Dict.empty
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I got the following error when decoding a big data structure:
I'm not sure if this repo is actively maintained so I won't bother creating a PR, but here is a tail recursive version of
dict2
if anyone needs it:The text was updated successfully, but these errors were encountered: