elm / compiler

Compiler for Elm, a functional language for reliable webapps.
https://elm-lang.org/
BSD 3-Clause "New" or "Revised" License
7.51k stars 656 forks source link

Confusing wording on syntax error #2215

Open tankorsmash opened 3 years ago

tankorsmash commented 3 years ago

https://github.com/elm/compiler/blob/770071accf791e8171440709effe71e78a9ab37c/compiler/src/Reporting/Error/Syntax.hs#L5081

Only the :: symbol that works in patterns. It is useful if you are pattern matching on lists, trying to get the first element off the front. Did you want that instead?

A rough ellie example that demonstrates the error:

I ran into the -> symbol unexpectedly in this pattern:

51|                 (String -> Result Decode.Error String) asd -> "Funnnccc"
                            ^^
Only the :: symbol that works in patterns. It is useful if you are pattern
matching on lists, trying to get the first element off the front. Did you want
that instead?

I'm new to Elm so maybe it's obvious with more knowledge, but it seems to be telling me that only the :: symbol works in patterns. I'm not clear on what it should be trying to tell me though.

github-actions[bot] commented 3 years ago

Thanks for reporting this! To set expectations:

Finally, please be patient with the core team. They are trying their best with limited resources.