elm-lang.org
elm-lang.org copied to clipboard
Try Elm error line numbers are off by one
If you break the Hello World example in Try Elm as shown below:
import Html exposing (text)
main =
tex "Hello, World!"
The error message is as follows:
Cannot find variable `tex`
5| tex "Hello, World!"
Notice that it says the error occurs on line 5 but it actually occurs on line 4. This is the case with all errors displayed while using Try Elm. That is to say, they are off by one.
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.
The reason for this and #679 is that a module
line is prepended to the program before it is compiled (at addHeader
), e.g. module Temp1481492898786019 exposing (..)
. This gives the program a random module name.
The only problem I can see with removing this line (and having the module name implicitly be Main
) is that parallel compilation of different programs would use the same intermediary .elmi
and .elmo
files, leading to a race condition.