Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upRuntime error when using Json.Decode #448
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jvoigtlaender
Nov 25, 2015
Contributor
Sounds very much like another instance of this issue: elm/compiler#873.
For some discussion of a case specifically for Json.Decode stuff, see https://github.com/elm-lang/core/issues/361.
On the core/library level, a remedy could be to add something like this or this combinator to Json.Decode.
|
Sounds very much like another instance of this issue: elm/compiler#873. For some discussion of a case specifically for On the |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
dasch
commented
Nov 25, 2015
|
:-( Is there a target release for fixing this? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
I don't know. @evancz? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
evancz
Nov 25, 2015
Member
I agree with @jvoigtlaender's assessment.
Is there a target release for fixing this?
Depends what you mean by "this". At some point I will sit down and fix the root compiler issue, but it's not my highest priority. It is definitely a bad experience that it leads to a crash, but it is an immediate crash so no goofy stuff happens 10 minutes in to execution.
So that bug is not blocking you, it is just annoying. The compiler just less helpful than normal in this case.
In terms of getting your code working, I'd read this where someone is trying to do pretty much the same thing as you. Then this to learn how to represent self-recursive data nicely.
If you are still struggling to get things working, I'd say ask about it on elm-discuss. There are a ton of folks who can add in the necessary lazy calls to get this working and they are happy to help!
|
I agree with @jvoigtlaender's assessment.
Depends what you mean by "this". At some point I will sit down and fix the root compiler issue, but it's not my highest priority. It is definitely a bad experience that it leads to a crash, but it is an immediate crash so no goofy stuff happens 10 minutes in to execution. So that bug is not blocking you, it is just annoying. The compiler just less helpful than normal in this case. In terms of getting your code working, I'd read this where someone is trying to do pretty much the same thing as you. Then this to learn how to represent self-recursive data nicely. If you are still struggling to get things working, I'd say ask about it on elm-discuss. There are a ton of folks who can add in the necessary |
evancz
closed this
Nov 25, 2015
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
dasch
Nov 26, 2015
I guess it's something that there are workarounds for, but it very much went against my expectations of how to use Elm – and I don't seem to be the only one. I think it's fine if it's not top priority, I just wanted to post this as feedback. I originally posted the code into the Slack channel where I got help, but the people there asked my to file it as a bug.
dasch
commented
Nov 26, 2015
|
I guess it's something that there are workarounds for, but it very much went against my expectations of how to use Elm – and I don't seem to be the only one. I think it's fine if it's not top priority, I just wanted to post this as feedback. I originally posted the code into the Slack channel where I got help, but the people there asked my to file it as a bug. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
dasch
commented
Nov 26, 2015
|
Thanks for taking your time to look at this! |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
johannth
May 6, 2017
I just managed to run into this issue by writing a recursive json decoder. My app compiled but crashed immediately at startup with a rather unhelpful error message, not obviously related to recursion. Definitely my first unfriendly experience with the otherwise super-friendly Elm compiler.
I'm unsure how common this scenario so I understand if this has low priority but just wanted to +1 on providing a compile time error if possible.
johannth
commented
May 6, 2017
|
I just managed to run into this issue by writing a recursive json decoder. My app compiled but crashed immediately at startup with a rather unhelpful error message, not obviously related to recursion. Definitely my first unfriendly experience with the otherwise super-friendly Elm compiler. I'm unsure how common this scenario so I understand if this has low priority but just wanted to +1 on providing a compile time error if possible. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
1602
Aug 9, 2017
This is one of the features damaging reputation of elm for more than two years (actually, Just One Issue I know about) and as far as I could tell everyone learning elm facing this issue and overall impression is like "they lied to me, it actually fails in runtime".
Just my two pence on prioritisation of this issue: even though it fails immediately, it makes learning elm harder than it should be.
1602
commented
Aug 9, 2017
•
|
This is one of the features damaging reputation of elm for more than two years (actually, Just One Issue I know about) and as far as I could tell everyone learning elm facing this issue and overall impression is like "they lied to me, it actually fails in runtime". Just my two pence on prioritisation of this issue: even though it fails immediately, it makes learning elm harder than it should be. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jvoigtlaender
Aug 9, 2017
Contributor
@1602, this will supposedly be fixed with the upcoming release of Elm 0.19. See elm/compiler#1591.
|
@1602, this will supposedly be fixed with the upcoming release of Elm 0.19. See elm/compiler#1591. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
1602
Aug 9, 2017
Thanks @jvoigtlaender!
I will try to test it on my code to confirm that it works with this fix, it seems related because after some code reorganisation I'm getting TypeError: Cannot read property 'tag' of undefined bug, which also referenced in elm/compiler#1591
1602
commented
Aug 9, 2017
|
Thanks @jvoigtlaender! I will try to test it on my code to confirm that it works with this fix, it seems related because after some code reorganisation I'm getting |
dasch commentedNov 25, 2015
I'm running into a runtime error when writing a recursive JSON decoder.
I have a few tests: some that verify that simple Avro schemas can be parsed and a single one that tries to verify that a complex record schema can be parsed. The latter fails with:
The problem is the last part,
callback is not a function. If I avoid the recursive reference toavroType, instead inlining the definition ofavroType, everything works.I haven't been able to reproduce it with a minimal example, so I'll post the full code here: