elm-repl
elm-repl copied to clipboard
Better error message when \ is followed by space
When typing in a multi-line value, where \ is used to request a line break, you can trigger an error by putting stuff after the /. Check out the very sneaky extra space in the following line:
> over9000 powerLevel = \
Python gives a relatively nice message when this mistake is made:
>>> 123 + 412 \
File "<stdin>", line 1
123 + 412 \
^
SyntaxError: unexpected character after line continuation character
>>>
We should do something like that.
this still doesn't work
no matter how I do the whitespace can't get this example to work in REPL http://elm-lang.org/guide/model-the-problem
longestName : List String -> Int
longestName names =
List.maximum (List.map String.length names)
Brand new to Elm. Got this same issue while running through core language guide, then inserted a space like someone mentioned in #79 . At least partly, this issue may be confustion with the guide itself. The "over9000 powerLevel" example might be a good place to refer to indentation for the first time.
Stumbled on this too, while following the Elm guide. Luckily the Elm slack #help was able to point out my whitespace error. Is the whitespace something that the repl could add where it knows things should be indented?
Also got here because of "over9000 powerLevel" example. The REPL didn't complain until after I typed the continuing line without leading spaces (which I hadn't noticed in the example), so that should have been a clue, but I had seen the leading | which I took to mean "I know you're continuing a line", so it didn't occur to me that I needed to do anything else to confirm that. I agree that it should add the leading spaces in that case.
@evancz, I have the similar problem on Windows 10, using Elm 0.17.1. To reproduce:
- Enter "> over9000 powerLevel = " (there is not any space after slash) and then "| powerLevel";
- Expected behaviour is to get the id function, but I got a syntax error with the message: "I am looking for one of the following things: end of input whitespace".
Touples example is quite impossible to write in repl. Tried many times didn't manage as of yet ...