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 comparing nested Html of different depths #694
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
process-bot
Aug 18, 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
Aug 18, 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. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
evancz
Aug 29, 2016
Member
Equality is not defined on virtual DOM values, so the fix is going to be modifying the compiler to detect when folks try to use equality in invalid cases (like on functions) and making that an error at compile time. This is already planned, so I'd rather not track the implications of that change here.
|
Equality is not defined on virtual DOM values, so the fix is going to be modifying the compiler to detect when folks try to use equality in invalid cases (like on functions) and making that an error at compile time. This is already planned, so I'd rather not track the implications of that change here. |
evancz
closed this
Aug 29, 2016
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jvoigtlaender
Aug 30, 2016
Contributor
But maybe at least mentioning this in the core documentation would be good? Currently, http://package.elm-lang.org/packages/elm-lang/core/4.0.5/Basics#== carries this note:
Note: Equality (in the Elm sense) is not possible for certain types. For example, the functions
(\n -> n + 1)and(\n -> 1 + n)are “the same” but detecting this in general is undecidable. In a future release, the compiler will detect when(==)is used with problematic types and provide a helpful error message. This will require quite serious infrastructure work that makes sense to batch with another big project, so the stopgap is to crash as quickly as possible. Problematic types include functions and JavaScript values likeJson.Encode.Valuewhich could contain functions if passed through a port.
That html values are also of "problematic type" seems important information for users, since trying to test views by comparing html values via == is something that is quite tempting. Currently neither the documentation for core nor for the html package tell users that using == on html values is not okay.
|
But maybe at least mentioning this in the
That html values are also of "problematic type" seems important information for users, since trying to test views by comparing html values via |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
lpil
Aug 30, 2016
A compiler error and improved documentation would be wonderful, thanks all.
Given we cannot test equality on html is there another method for testing views? Often I have business logic that results in html that I would love to be able to test.
lpil
commented
Aug 30, 2016
|
A compiler error and improved documentation would be wonderful, thanks all. Given we cannot test equality on html is there another method for testing views? Often I have business logic that results in html that I would love to be able to test. |
lpil commentedAug 18, 2016
Hello!
Today while trying to do some testing I encounted a runtime error. Here's a recreation.
Elm version 0.17.0, installed via the
elmpackage on npm.Debian Jessie Linux OS.
Running Elm in node v4.1.1 via the REPL.
Here are the entries from my
elm-stuff/exact-dependencies.json.I was pointed over here from elm/compiler#1465