elm / error-message-catalog

A catalog of broken Elm programs / data to improve error messages
BSD 3-Clause "New" or "Revised" License
173 stars 17 forks source link

Confusing message when using single quotes for strings inside lists #229

Closed ellogwen closed 5 years ago

ellogwen commented 7 years ago

Trying out elm with the elm-repl but instantly got confused be the below error message

image

Since double quotes are hard to write for me on my keyboard layout I got used to using single quotes for defining string. Hadn't thought that that would be a big deal in elm. Well, the error message is misleading anyway .

kipanshi commented 6 years ago

Having the same issue, the string can't be defined with single quotes, but the message is misleading.

evancz commented 5 years ago

Thank you for the report! In 0.19 the error message looks like this:

> names = ['Alice', 'Bob', 'Charlie']
-- PARSE ERROR ------------------------------------------------------------- elm

Ran into a bad use of single quotes.

3| names = ['Alice', 'Bob', 'Charlie']
            ^^^^^^^
If you want to create a string, switch to double quotes:

    'this' => "this"

Hint: Unlike JavaScript, Elm distinguishes between strings like "hello" and
individual characters like 'A' and '3'. If you really do want a character
though, something went wrong and I did not find the closing single quote.