Using `_Tuple` constructors results in runtime error
Closed this issue · 3 comments
Elm version 0.18.0
If an Elm program tries to explicitly use the constructor _Tuple2, it will compile without error but will crash at runtime.
val = _Tuple2 "foo" "bar"The Javascript error is that the variable _Tuple2 does not exist. It appears that the Elm compiler is generating JS for this situation as if it were a call to the nonexistent _Tuple2 function, instead of a constructor application. (i.e., generating A2(_Tuple2, "foo", "bar") instead of {ctor: '_Tuple2', _0: "foo", _1: "bar"})
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.
SSCCE: (this compiles and then throws a runtime exception)
module Main exposing (..)
import Html exposing (Html, text)
main : Html a
main =
text (toString <| _Tuple2 "foo" "bar")
This does not parse in the 0.19 code I am working with. The underlying representation of tuples is also better, so the mechanism that allowed this in 0.18 no longer exists. Thanks for the report!