@@ -542,9 +542,7 @@ problemToReport subRegion problem =
542 "Maybe you want :: instead? Or maybe your indentation is a bit off?"
542 "Maybe you want :: instead? Or maybe your indentation is a bit off?"
544 Equals ->
544 Equals ->
545− badOp subRegion stack "an equals sign" "(=)"
545+ badEquals subRegion stack
547− "Maybe you want == instead? Or maybe your indentation is a bit off?"
550 if isCaseRelated stack then
548 if isCaseRelated stack then
@@ -631,6 +629,42 @@ badOp subRegion stack opName op setting hint =
632+badEquals :: Maybe R.Region -> ContextStack -> Report.Report
633+badEquals subRegion stack =
636+ "I was not expecting this equals sign"
637+ <> contextToText "" " while parsing " stack <> "."
639+ makeParseReport subRegion pre (badEqualsHelp stack)
642+badEqualsHelp :: ContextStack -> Help.Doc
643+badEqualsHelp stack =
647+ "Maybe you want == instead? Or maybe your indentation is a bit off?"
649+ (ExprRecord, _) : _ ->
651+ "Records look like { x = 3, y = 4 } with the equals sign right\
652+ \ after the field name. Maybe you forgot a comma?"
654+ (Definition name, _) : rest ->
656+ "Maybe this is supposed to be a separate definition? If so, it\
657+ \ is indented too far. "
659+ if any ((==) ExprLet . fst) rest then
660+ "All definitions in a `let` expression must be vertically aligned."
662+ "Spaces are not allowed before top-level definitions."
634contextToText :: Text -> Text -> ContextStack -> Text
668contextToText :: Text -> Text -> ContextStack -> Text
635contextToText defaultText prefixText stack =
669contextToText defaultText prefixText stack =
636 case stack of
670 case stack of