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 upComparing nested arrays stored in Json.Value can result in runtime error #945
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment
Hide comment
process-bot
Feb 28, 2018
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
Feb 28, 2018
|
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. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment
Hide comment
Widdershin
Feb 28, 2018
Also just noticed another curiosity:
> Json.decodeString Json.value "[]" == Json.decodeString Json.value "[[1]]"
True : BoolShould probably return False. Happy to open a separate issue if desired.
Widdershin
commented
Feb 28, 2018
|
Also just noticed another curiosity: > Json.decodeString Json.value "[]" == Json.decodeString Json.value "[[1]]"
True : BoolShould probably return |
evancz
added
the
problem
label
Mar 7, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Widdershin commentedFeb 28, 2018
•
edited
Edited 3 times
-
Widdershin
edited Feb 28, 2018 (most recent)
-
Widdershin
edited Feb 28, 2018
-
Widdershin
edited Feb 28, 2018
Hello,
I work in a team that's using Elm and we're very happy with it, thank you all for your hard work.
We have encountered a runtime error when attempting to compare Json.value objects with different structures. After a bit of digging, it became clear that the underlying issue was around comparing arrays with different levels of nesting:
I appreciate that comparing
Json.valueobjects is not very good form, and we'll workaround this issue by not doing that. It's not desirable for us to decode these particular objects, as they can be very large and the Elm part of our application does not actually need to have a model of the contents.In any case, it seems desirable to remove this class of runtime errors, since it seems quite feasible to do so.
The error is coming from the eqHelp function. It appears that extending the null check to cover undefined would resolve this issue.
I do not have currently have time to prepare a quality PR, but perhaps something like this?
Unsure if this should apply to
xas well, but I'm pretty sure the above fix would be sufficient to avoid this runtime error.I hope this is enough to go on. Happy to answer any questions.
Elm version: 0.18
Tested on: Firefox and Chrome latest on Mac OS