Closed jjant closed 5 years ago
With the development build, the particular example you gave gives the following error:
-- SYNTAX PROBLEM ----------------------------------------------------- temp.elm
I was expecting to see a declaration, but I am getting stuck here:
4| (>>=) : a -> b -> a
^
Declarations normally start with a lower-case name or the `type` keyword.
Hint: Here are a couple valid declarations for reference:
add : Int -> Int -> Int
add x y =
x + y
type User = Anonymous | LoggedIn String
Notice that these declarations start with lower-case letters. Capitalization
makes a difference in Elm!
This covers the common case of someone accidentally starting a line with a capital letter, and I think it'd be weaker for that case if it had the additional information you are suggesting.
So then the question is whether specific logic be added to the parser and syntax error message code to account for these specific cases. I think infix operators probably were more widely used, but the research I did on packages showed it appeared in about 5% of them. It's definitely possible to have more than just the release notes for folks to know about this change, but I have a hard time justifying the trickiness that'd go into the syntax error message code to detect this.
Defining an effect module or an infix operator throws a parse error, it'd be quite better for people returning into elm to explain that these things were removed instead of just failing to parse the line.
Example: https://ellie-app.com/3Fb9RYW8XBDa1