Skip to content

Commit 00ee154

Browse files
committed
tweak error message for unexpected arrow in expressions
Fixes elm/error-message-catalog#241
1 parent 98b963c commit 00ee154

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

compiler/src/Reporting/Error/Syntax.hs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2868,11 +2868,15 @@ toOperatorReport source context operator row col =
28682868
else
28692869
(
28702870
D.reflow $
2871-
"I was not expecting an arrow here:"
2871+
"I was partway through parsing an expression when I got stuck on this arrow:"
28722872
,
2873-
D.reflow $
2874-
"Arrows should only appear in `case` expressions and anonymous functions. Maybe\
2875-
\ you want > or >= instead?"
2873+
D.stack
2874+
[ "Arrows should only appear in `case` expressions and anonymous functions.\n\
2875+
\Maybe it was supposed to be a > sign instead?"
2876+
, D.toSimpleNote $
2877+
"The syntax for anonymous functions is (\\x -> x + 1) so the arguments all appear\
2878+
\ after the backslash and before the arrow. Maybe you forgot the backslash earlier?"
2879+
]
28762880
)
28772881

28782882
BadEquals ->

0 commit comments

Comments
 (0)