New issue

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

decoding recursive data from JSON hangs #665

Closed
ContiGuy opened this Issue Jul 15, 2016 · 2 comments

Comments

Projects
None yet
3 participants
@ContiGuy

ContiGuy commented Jul 15, 2016

Hi, I'm trying to encode and decode a recursive data structure from Json. I have tried several ways to design my structure to be able to decode it from Json but it always hangs. I'm totally new to Elm and functional programming, so please forgive my ignorance.

  1. As recommended by the Elm compiler, a record with an embedded indirectly recursive union type. See attachment
    record-with-indirect-recursive-union-hangs-on-json-decode.elm.txt
  2. then I tried to redesign the structure to primarily use a (directly) recursive union type because that seemed to work but when I expanded it a little it also hangs while decoding Json.
    direct-recursive-union-with-record-hangs-on-json-decode.elm.txt

This one is especially interesting because by making a tiny change in a let expression it can be switched from working to hanging and back. Please see the other attachment.

It would be really great if someone could fix the problem or suggest a workaround.
Thank you very much!

Browser: Firefox 47.0
Elm: 0.17.1

@process-bot

This comment has been minimized.

Show comment
Hide comment
@process-bot

process-bot Jul 15, 2016

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

process-bot commented Jul 15, 2016

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

@jvoigtlaender

This comment has been minimized.

Show comment
Hide comment
@jvoigtlaender

jvoigtlaender Jul 15, 2016

Contributor

You already know about Json.Decode.Extra.lazy, otherwise I would have referred you to my response to a similar issue (https://github.com/elm-lang/core/issues/664) a few hours ago.

Given what you know, the best venue for your question would be a community forum, for example the mailing list. Please see http://elm-lang.org/community for various options.

This issue tracker is really for bugs or things that need change in core.

Contributor

jvoigtlaender commented Jul 15, 2016

You already know about Json.Decode.Extra.lazy, otherwise I would have referred you to my response to a similar issue (https://github.com/elm-lang/core/issues/664) a few hours ago.

Given what you know, the best venue for your question would be a community forum, for example the mailing list. Please see http://elm-lang.org/community for various options.

This issue tracker is really for bugs or things that need change in core.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment