@@ -649,9 +649,184 @@ toParseErrorReport source modul =
649 toSpaceReport source space row col
649 toSpaceReport source space row col
651 ModuleBadEnd row col ->
651 ModuleBadEnd row col ->
652− if col == 1
652+ case Code.whatIsNext source row col of
653− then toDeclStartReport source row col
653+ Code.Keyword keyword ->
654− else toWeirdEndReport source row col
654+ let
655+ region = toKeywordRegion row col keyword
657+ Report.Report "RESERVED WORD" region [] $
658+ Code.toSnippet source region Nothing
661+ "I got stuck on this reserved word:"
664+ "The name `" ++ keyword ++ "` is reserved, so try using a different name?"
669+ region = toKeywordRegion row col op
671+ Report.Report "UNEXPECTED SYMBOL" region [] $
672+ Code.toSnippet source region Nothing
675+ "I ran into an unexpected symbol:"
678+ "I was not expecting to see a " ++ op ++ " here. Try deleting it? Maybe\
679+ \ I can give a better hint from there?"
682+ Code.Close term bracket ->
684+ region = toRegion row col
686+ Report.Report ("UNEXPECTED " ++ map Char.toUpper term) region [] $
687+ Code.toSnippet source region Nothing
690+ "I ran into an unexpected " ++ term ++ ":"
693+ "This " ++ bracket : " does not match up with an earlier open " ++ term ++ ". Try deleting it?"
698+ region = toKeywordRegion row col (c:cs)
700+ Report.Report "UNEXPECTED NAME" region [] $
701+ Code.toSnippet source region Nothing
704+ "I got stuck on this name:"
707+ "It is confusing me a lot! Normally I can give fairly specific hints, but\
708+ \ something is really tripping me up this time."
713+ region = toKeywordRegion row col (c:cs)
715+ Report.Report "UNEXPECTED NAME" region [] $
716+ Code.toSnippet source region Nothing
719+ "I got stuck on this name:"
722+ "It is confusing me a lot! Normally I can give fairly specific hints, but\
723+ \ something is really tripping me up this time."
726+ Code.Other maybeChar ->
728+ region = toRegion row col
732+ Report.Report "UNEXPECTED SEMICOLON" region [] $
733+ Code.toSnippet source region Nothing
736+ "I got stuck on this semicolon:"
739+ [ D.reflow $ "Try removing it?"
741+ "Some languages require semicolons at the end of each statement. These are\
742+ \ often called C-like languages, and they usually share a lot of language design\
743+ \ choices. (E.g. side-effects, for loops, etc.) Elm manages effects with commands\
744+ \ and subscriptions instead, so there is no special syntax for \"statements\" and\
745+ \ therefore no need to use semicolons to separate them. I think this will make\
746+ \ more sense as you work through <https://guide.elm-lang.org> though!"
751+ Report.Report "UNEXPECTED COMMA" region [] $
752+ Code.toSnippet source region Nothing
755+ "I got stuck on this comma:"
759+ "I do not think I am parsing a list or tuple right now. Try deleting the comma?"
761+ "If this is supposed to be part of a list, the problem may be a bit earlier.\
762+ \ Perhaps the opening [ is missing? Or perhaps some value in the list has an extra\
763+ \ closing ] that is making me think the list ended earlier? The same kinds of\
764+ \ things could be going wrong if this is supposed to be a tuple."
769+ Report.Report "UNEXPECTED CHARACTER" region [] $
770+ Code.toSnippet source region Nothing
773+ "I got stuck on this character:"
777+ "It is not used for anything in Elm syntax. It is used for multi-line strings in\
778+ \ some languages though, so if you want a string that spans multiple lines, you\
779+ \ can use Elm's multi-line string syntax like this:"
780+ , D.dullyellow $ D.indent 4 $ D.vcat $
782+ , "# Multi-line Strings"
784+ , "- start with triple double quotes"
785+ , "- write whatever you want"
786+ , "- no need to escape newlines or double quotes"
787+ , "- end with triple double quotes"
791+ "Otherwise I do not know what is going on! Try removing the character?"
796+ Report.Report "UNEXPECTED SYMBOL" region [] $
797+ Code.toSnippet source region Nothing
800+ "I got stuck on this dollar sign:"
803+ "It is not used for anything in Elm syntax. Are you coming from a language where\
804+ \ dollar signs can be used in variable names? If so, try a name that (1) starts\
805+ \ with a letter and (2) only contains letters, numbers, and underscores."
808+ Just c | elem c ['#','@','!','%','~'] ->
809+ Report.Report "UNEXPECTED SYMBOL" region [] $
810+ Code.toSnippet source region Nothing
813+ "I got stuck on this symbol:"
816+ "It is not used for anything in Elm syntax. Try removing it?"
820+ Report.Report "SYNTAX PROBLEM" region [] $
821+ Code.toSnippet source region Nothing
827+ "Whatever I am running into is confusing me a lot! Normally I can give fairly\
828+ \ specific hints, but something is really tripping me up this time."
656 ModuleProblem row col ->
831 ModuleProblem row col ->
@@ -835,7 +1010,6 @@ toParseErrorReport source modul =
836 , D.reflow $
1011 , D.reflow $
837 "Notice that the module names all start with capital letters. That is required!"
1012 "Notice that the module names all start with capital letters. That is required!"
838− , D.reflowLink "Read" "imports" "to learn more."
@@ -862,7 +1036,6 @@ toParseErrorReport source modul =
863 , D.reflow $
1037 , D.reflow $
864 "Notice that the alias always starts with a capital letter. That is required!"
1038 "Notice that the alias always starts with a capital letter. That is required!"
865− , D.reflowLink "Read" "imports" "to learn more."
@@ -925,192 +1098,6 @@ toParseErrorReport source modul =
931−toWeirdEndReport :: Code.Source -> Row -> Col -> Report.Report
932−toWeirdEndReport source row col =
933− case Code.whatIsNext source row col of
934− Code.Keyword keyword ->
936− region = toKeywordRegion row col keyword
938− Report.Report "RESERVED WORD" region [] $
939− Code.toSnippet source region Nothing
942− "I got stuck on this reserved word:"
945− "The name `" ++ keyword ++ "` is reserved, so try using a different name?"
950− region = toKeywordRegion row col op
952− Report.Report "UNEXPECTED SYMBOL" region [] $
953− Code.toSnippet source region Nothing
956− "I ran into an unexpected symbol:"
959− "I was not expecting to see a " ++ op ++ " here. Try deleting it? Maybe\
960− \ I can give a better hint from there?"
963− Code.Close term bracket ->
965− region = toRegion row col
967− Report.Report ("UNEXPECTED " ++ map Char.toUpper term) region [] $
968− Code.toSnippet source region Nothing
971− "I ran into an unexpected " ++ term ++ ":"
974− "This " ++ bracket : " does not match up with an earlier open " ++ term ++ ". Try deleting it?"
979− region = toKeywordRegion row col (c:cs)
981− Report.Report "UNEXPECTED NAME" region [] $
982− Code.toSnippet source region Nothing
985− "I got stuck on this name:"
988− "It is confusing me a lot! Normally I can give fairly specific hints, but\
989− \ something is really tripping me up this time."
994− region = toKeywordRegion row col (c:cs)
996− Report.Report "UNEXPECTED NAME" region [] $
997− Code.toSnippet source region Nothing
1000− "I got stuck on this name:"
1003− "It is confusing me a lot! Normally I can give fairly specific hints, but\
1004− \ something is really tripping me up this time."
1007− Code.Other maybeChar ->
1009− region = toRegion row col
1013− Report.Report "UNEXPECTED SEMICOLON" region [] $
1014− Code.toSnippet source region Nothing
1017− "I got stuck on this semicolon:"
1020− [ D.reflow $ "Try removing it?"
1022− "Some languages require semicolons at the end of each statement. These are\
1023− \ often called C-like languages, and they usually share a lot of language design\
1024− \ choices. (E.g. side-effects, for loops, etc.) Elm manages effects with commands\
1025− \ and subscriptions instead, so there is no special syntax for \"statements\" and\
1026− \ therefore no need to use semicolons to separate them. I think this will make\
1027− \ more sense as you work through <https://guide.elm-lang.org> though!"
1032− Report.Report "UNEXPECTED COMMA" region [] $
1033− Code.toSnippet source region Nothing
1036− "I got stuck on this comma:"
1040− "I do not think I am parsing a list or tuple right now. Try deleting the comma?"
1042− "If this is supposed to be part of a list, the problem may be a bit earlier.\
1043− \ Perhaps the opening [ is missing? Or perhaps some value in the list has an extra\
1044− \ closing ] that is making me think the list ended earlier? The same kinds of\
1045− \ things could be going wrong if this is supposed to be a tuple."
1050− Report.Report "UNEXPECTED CHARACTER" region [] $
1051− Code.toSnippet source region Nothing
1054− "I got stuck on this character:"
1058− "It is not used for anything in Elm syntax. It is used for multi-line strings in\
1059− \ some languages though, so if you want a string that spans multiple lines, you\
1060− \ can use Elm's multi-line string syntax like this:"
1061− , D.dullyellow $ D.indent 4 $ D.vcat $
1063− , "# Multi-line Strings"
1065− , "- start with triple double quotes"
1066− , "- write whatever you want"
1067− , "- no need to escape newlines or double quotes"
1068− , "- end with triple double quotes"
1072− "Otherwise I do not know what is going on! Try removing the character?"
1077− Report.Report "UNEXPECTED SYMBOL" region [] $
1078− Code.toSnippet source region Nothing
1081− "I got stuck on this dollar sign:"
1084− "It is not used for anything in Elm syntax. Are you coming from a language where\
1085− \ dollar signs can be used in variable names? If so, try a name that (1) starts\
1086− \ with a letter and (2) only contains letters, numbers, and underscores."
1089− Just c | elem c ['#','@','!','%','~'] ->
1090− Report.Report "UNEXPECTED SYMBOL" region [] $
1091− Code.toSnippet source region Nothing
1094− "I got stuck on this symbol:"
1097− "It is not used for anything in Elm syntax. Try removing it?"
1101− Report.Report "SYNTAX PROBLEM" region [] $
1102− Code.toSnippet source region Nothing
1105− "I got stuck here:"
1108− "Whatever I am running into is confusing me a lot! Normally I can give fairly\
1109− \ specific hints, but something is really tripping me up this time."
1114-- IMPORTS
1101-- IMPORTS
@@ -1136,7 +1123,6 @@ toImportReport source row col =
1137 , D.reflow $
1124 , D.reflow $
1138 "You are probably trying to import a different module, but try to make it look like one of these examples!"
1125 "You are probably trying to import a different module, but try to make it look like one of these examples!"
1139− , D.reflowLink "Read" "imports" "to learn more."
@@ -1443,196 +1429,191 @@ toDeclarationsReport :: Code.Source -> Decl -> Report.Report
1443toDeclarationsReport source decl =
1429toDeclarationsReport source decl =
1444 case decl of
1430 case decl of
1445 DeclStart row col ->
1431 DeclStart row col ->
1446− toDeclStartReport source row col
1432+ case Code.whatIsNext source row col of
1447−
1433+ Code.Close term bracket ->
1448− DeclSpace space row col ->
1434+ let
1449− toSpaceReport source space row col
1435+ region = toRegion row col
1451− Port port_ row col ->
1437+ Report.Report ("STRAY " ++ map Char.toUpper term) region [] $
1452− toPortReport source port_ row col
1438+ Code.toSnippet source region Nothing
1454− DeclType declType row col ->
1440+ D.reflow $
1455− toDeclTypeReport source declType row col
1441+ "I was not expecting to see a " ++ term ++ " here:"
1457− DeclDef name declDef row col ->
1443+ "This " ++ bracket : " does not match up with an earlier open " ++ term ++ ". Try deleting it?"
1458− toDeclDefReport source name declDef row col
1444+ )
1460− DeclFreshLineAfterDocComment row col ->
1446+ Code.Keyword keyword ->
1462− region = toRegion row col
1448+ region = toKeywordRegion row col keyword
1464− Report.Report "EXPECTING DECLARATION" region [] $
1450+ Report.Report "RESERVED WORD" region [] $
1465− Code.toSnippet source region Nothing
1451+ Code.toSnippet source region Nothing
1468− "I just saw a doc comment, but then I got stuck here:"
1470− D.reflow $
1453+ D.reflow $
1471− "I was expecting to see the corresponding declaration next, starting on a fresh\
1454+ "I was not expecting to run into the `" ++ keyword ++ "` keyword here:"
1472− \ line with no indentation."
1455+ ,
1473− )
1456+ case keyword of
1459+ "It is reserved for declaring imports at the top of your module. If you want\
1460+ \ another import, try moving it up top with the other imports. If you want to\
1461+ \ define a value or function, try changing the name to something else!"
1466+ "It is reserved for writing `case` expressions. Try using a different name?"
1468+ "If you are trying to write a `case` expression, it needs to be part of a\
1469+ \ definition. So you could write something like this instead:"
1470+ , D.indent 4 $ D.vcat $
1471+ [ D.indent 0 $ D.fillSep ["getWidth","maybeWidth","="]
1472+ , D.indent 2 $ D.fillSep [D.cyan "case","maybeWidth",D.cyan "of"]
1473+ , D.indent 4 $ D.fillSep [D.blue "Just","width","->"]
1474+ , D.indent 6 $ D.fillSep ["width","+",D.dullyellow "200"]
1476+ , D.indent 4 $ D.fillSep [D.blue "Nothing","->"]
1477+ , D.indent 6 $ D.fillSep [D.dullyellow "400"]
1480+ "This defines a `getWidth` function that you can use elsewhere in your program."
1486+ "It is reserved for writing `if` expressions. Try using a different name?"
1488+ "If you are trying to write an `if` expression, it needs to be part of a\
1489+ \ definition. So you could write something like this instead:"
1490+ , D.indent 4 $ D.vcat $
1494+ ,D.cyan "if","name","==",D.dullyellow "\"Abraham Lincoln\""
1495+ ,D.cyan "then",D.dullyellow "\"Greetings Mr. President.\""
1496+ ,D.cyan "else",D.dullyellow "\"Hey!\""
1500+ "This defines a `reviewPowerLevel` function that you can use elsewhere in your program."
1476−toDeclStartReport :: Code.Source -> Row -> Col -> Report.Report
1503+ _ ->
1477−toDeclStartReport source row col =
1478− case Code.whatIsNext source row col of
1479− Code.Close term bracket ->
1481− region = toRegion row col
1483− Report.Report ("STRAY " ++ map Char.toUpper term) region [] $
1484− Code.toSnippet source region Nothing
1486− D.reflow $
1504+ D.reflow $
1487− "I was not expecting to see a " ++ term ++ " here:"
1505+ "It is a reserved word. Try changing the name to something else?"
1489− "This " ++ bracket : " does not match up with an earlier open " ++ term ++ ". Try deleting it?"
1492− Code.Keyword keyword ->
1508+ Code.Upper c cs ->
1494− region = toKeywordRegion row col keyword
1510+ region = toRegion row col
1496− Report.Report "RESERVED WORD" region [] $
1512+ Report.Report "UNEXPECTED CAPITAL LETTER" region [] $
1497− Code.toSnippet source region Nothing
1513+ Code.toSnippet source region Nothing
1500− "I was not expecting to run into the `" ++ keyword ++ "` keyword here:"
1504 D.reflow $
1515 D.reflow $
1505− "It is reserved for declaring imports at the top of your module. If you want\
1516+ "Declarations always start with a lower-case letter, so I am getting stuck here:"
1506− \ another import, try moving it up top with the other imports. If you want to\
1517+ ,
1507− \ define a value or function, try changing the name to something else!"
1511− [ D.reflow $
1519+ [ D.fillSep $
1512− "It is reserved for writing `case` expressions. Try using a different name?"
1520+ ["Try","a","name","like"
1521+ ,D.green (D.fromChars (Char.toLower c : cs))
1513 , D.toSimpleNote $
1524 , D.toSimpleNote $
1514− "If you are trying to write a `case` expression, it needs to be part of a\
1525+ "Here are a couple valid declarations for reference:"
1515− \ definition. So you could write something like this instead:"
1516 , D.indent 4 $ D.vcat $
1526 , D.indent 4 $ D.vcat $
1517− [ D.indent 0 $ D.fillSep ["getWidth","maybeWidth","="]
1527+ [ "greet : String -> String"
1518− , D.indent 2 $ D.fillSep [D.cyan "case","maybeWidth",D.cyan "of"]
1528+ , "greet name ="
1519− , D.indent 4 $ D.fillSep [D.blue "Just","width","->"]
1529+ , " " <> D.dullyellow "\"Hello \"" <> " ++ name ++ " <> D.dullyellow "\"!\""
1520− , D.indent 6 $ D.fillSep ["width","+",D.dullyellow "200"]
1522− , D.indent 4 $ D.fillSep [D.blue "Nothing","->"]
1531+ , D.cyan "type" <> " User = Anonymous | LoggedIn String"
1523− , D.indent 6 $ D.fillSep [D.dullyellow "400"]
1525 , D.reflow $
1533 , D.reflow $
1526− "This defines a `getWidth` function that you can use elsewhere in your program."
1534+ "Notice that they always start with a lower-case letter. Capitalization matters!"
1529− "if" ->
1538+ Code.Other (Just char) | elem char ['(', '{', '[', '+', '-', '*', '/', '^', '&', '|', '"', '\'', '!', '@', '#', '$', '%'] ->
1540+ region = toRegion row col
1542+ Report.Report "UNEXPECTED SYMBOL" region [] $
1543+ Code.toSnippet source region Nothing
1546+ "I am getting stuck because this line starts with the " ++ [char] ++ " symbol:"
1531 [ D.reflow $
1549 [ D.reflow $
1532− "It is reserved for writing `if` expressions. Try using a different name?"
1550+ "When a line has no spaces at the beginning, I expect it to be a declaration like one of these:"
1534− "If you are trying to write an `if` expression, it needs to be part of a\
1535− \ definition. So you could write something like this instead:"
1536 , D.indent 4 $ D.vcat $
1551 , D.indent 4 $ D.vcat $
1537− [ "greet name ="
1552+ [ "greet : String -> String"
1538− , D.fillSep $
1553+ , "greet name ="
1540− ,D.cyan "if","name","==",D.dullyellow "\"Abraham Lincoln\""
1541− ,D.cyan "then",D.dullyellow "\"Greetings Mr. President.\""
1542− ,D.cyan "else",D.dullyellow "\"Hey!\""
1554+ , " " <> D.dullyellow "\"Hello \"" <> " ++ name ++ " <> D.dullyellow "\"!\""
1556+ , D.cyan "type" <> " User = Anonymous | LoggedIn String"
1545 , D.reflow $
1558 , D.reflow $
1546− "This defines a `reviewPowerLevel` function that you can use elsewhere in your program."
1559+ "If this is not supposed to be a declaration, try adding some spaces before it?"
1565+ region = toRegion row col
1567+ Report.Report "WEIRD DECLARATION" region [] $
1568+ Code.toSnippet source region Nothing
1550 D.reflow $
1570 D.reflow $
1551− "It is a reserved word. Try changing the name to something else?"
1571+ "I am trying to parse a declaration, but I am getting stuck here:"
1556− region = toRegion row col
1558− Report.Report "UNEXPECTED CAPITAL LETTER" region [] $
1559− Code.toSnippet source region Nothing
1562− "Declarations always start with a lower-case letter, so I am getting stuck here:"
1564− D.stack
1573+ D.stack
1565− [ D.fillSep $
1574+ [ D.reflow $
1566− ["Try","a","name","like"
1567− ,D.green (D.fromChars (Char.toLower c : cs))
1571− "Here are a couple valid declarations for reference:"
1575+ "I am not sure what is going wrong, so here are a couple valid declarations for reference:"
1572− , D.indent 4 $ D.vcat $
1576+ , D.indent 4 $ D.vcat $
1573− [ "greet : String -> String"
1577+ [ "greet : String -> String"
1574− , "greet name ="
1578+ , "greet name ="
1575− , " " <> D.dullyellow "\"Hello \"" <> " ++ name ++ " <> D.dullyellow "\"!\""
1579+ , " " <> D.dullyellow "\"Hello \"" <> " ++ name ++ " <> D.dullyellow "\"!\""
1577− , D.cyan "type" <> " User = Anonymous | LoggedIn String"
1581+ , D.cyan "type" <> " User = Anonymous | LoggedIn String"
1584+ "Try to make your declaration look like one of those?"
1580− "Notice that they always start with a lower-case letter. Capitalization matters!"
1584− Code.Other (Just char) | elem char ['(', '{', '[', '+', '-', '*', '/', '^', '&', '|', '"', '\'', '!', '@', '#', '$', '%'] ->
1588+ DeclSpace space row col ->
1585− let
1589+ toSpaceReport source space row col
1586− region = toRegion row col
1590+
1587− in
1591+ Port port_ row col ->
1588− Report.Report "UNEXPECTED SYMBOL" region [] $
1592+ toPortReport source port_ row col
1589− Code.toSnippet source region Nothing
1593+
1590− (
1594+ DeclType declType row col ->
1591− D.reflow $
1595+ toDeclTypeReport source declType row col
1592− "I am getting stuck because this line starts with the " ++ [char] ++ " symbol:"
1596+
1593− ,
1597+ DeclDef name declDef row col ->
1594− D.stack
1598+ toDeclDefReport source name declDef row col
1596− "When a line has no spaces at the beginning, I expect it to be a declaration like one of these:"
1597− , D.indent 4 $ D.vcat $
1598− [ "greet : String -> String"
1600− , " " <> D.dullyellow "\"Hello \"" <> " ++ name ++ " <> D.dullyellow "\"!\""
1602− , D.cyan "type" <> " User = Anonymous | LoggedIn String"
1605− "If this is not supposed to be a declaration, try adding some spaces before it?"
1609− _ ->
1600+ DeclFreshLineAfterDocComment row col ->
1611 region = toRegion row col
1602 region = toRegion row col
1613− Report.Report "WEIRD DECLARATION" region [] $
1604+ Report.Report "EXPECTING DECLARATION" region [] $
1614 Code.toSnippet source region Nothing
1605 Code.toSnippet source region Nothing
1616 D.reflow $
1607 D.reflow $
1617− "I am trying to parse a declaration, but I am getting stuck here:"
1608+ "I just saw a doc comment, but then I got stuck here:"
1620− [ D.reflow $
1610+ D.reflow $
1621− "When a line has no spaces at the beginning, I expect it to be a declaration like one of these:"
1611+ "I was expecting to see the corresponding declaration next, starting on a fresh\
1622− , D.indent 4 $ D.vcat $
1612+ \ line with no indentation."
1623− [ "greet : String -> String"
1625− , " " <> D.dullyellow "\"Hello \"" <> " ++ name ++ " <> D.dullyellow "\"!\""
1627− , D.cyan "type" <> " User = Anonymous | LoggedIn String"
1630− "Try to make your declaration look like one of those? Or if this is not\
1631− \ supposed to be a declaration, try adding some spaces before it?"
@@ -2591,7 +2572,7 @@ toExprReport source context expr startRow startCol =
2591 ,"give","a","more","specific","hint!"
2572 ,"give","a","more","specific","hint!"
2593 , D.toSimpleNote $
2574 , D.toSimpleNote $
2594− "This can also happen if I run into reserved words like `let` or `as` unexpectedly.\
2575+ "This can also happen if run into reserved words like `let` or `as` unexpectedly.\
2595 \ Or if I run into operators in unexpected spots. Point is, there are a\
2576 \ Or if I run into operators in unexpected spots. Point is, there are a\
2596 \ couple ways I can get confused and give sort of weird advice!"
2577 \ couple ways I can get confused and give sort of weird advice!"
@@ -4146,13 +4127,11 @@ toRecordReport source context record startRow startCol =
4146 D.reflow $
4127 D.reflow $
4147 "I just saw the opening curly brace of a record, but then I got stuck here:"
4128 "I just saw the opening curly brace of a record, but then I got stuck here:"
4149− D.stack
4130+ addNoteForRecordIndentError $
4150− [ D.fillSep $
4131+ D.fillSep $
4151− ["I","am","expecting","a","record","like",D.dullyellow "{ x = 3, y = 4 }","here."
4132+ ["I","am","expecting","a","record","like",D.dullyellow "{ x = 3, y = 4 }","here."
4152− ,"Try","defining","some","fields","of","your","own?"
4133+ ,"Try","defining","some","fields","of","your","own?"
4154− , noteForRecordIndentError
4158 RecordIndentEnd row col ->
4137 RecordIndentEnd row col ->
@@ -4186,13 +4165,11 @@ toRecordReport source context record startRow startCol =
4186 D.reflow $
4165 D.reflow $
4187 "I was partway through parsing a record, but I got stuck here:"
4166 "I was partway through parsing a record, but I got stuck here:"
4189− D.stack
4168+ addNoteForRecordIndentError $
4190− [ D.fillSep $
4169+ D.fillSep $
4191− ["I","was","expecting","to","see","a","closing","curly","brace","next."
4170+ ["I","was","expecting","to","see","a","closing","curly","brace","next."
4192− ,"Try","putting","a",D.green "}","next","and","see","if","that","helps?"
4171+ ,"Try","putting","a",D.green "}","next","and","see","if","that","helps?"
4194− , noteForRecordIndentError
4198 RecordIndentField row col ->
4175 RecordIndentField row col ->
@@ -4227,12 +4204,10 @@ toRecordReport source context record startRow startCol =
4227 "I am partway through parsing a record. I just saw a record\
4204 "I am partway through parsing a record. I just saw a record\
4228 \ field, so I was expecting to see an equals sign next:"
4205 \ field, so I was expecting to see an equals sign next:"
4230− D.stack
4207+ addNoteForRecordIndentError $
4231− [ D.fillSep $
4208+ D.fillSep $
4232− ["Try","putting","an",D.green "=","followed","by","an","expression?"
4209+ ["Try","putting","an",D.green "=","followed","by","an","expression?"
4234− , noteForRecordIndentError
4238 RecordIndentExpr row col ->
4213 RecordIndentExpr row col ->
@@ -4246,13 +4221,11 @@ toRecordReport source context record startRow startCol =
4246 D.reflow $
4221 D.reflow $
4247 "I am partway through parsing a record, and I was expecting to run into an expression next:"
4222 "I am partway through parsing a record, and I was expecting to run into an expression next:"
4249− D.stack
4224+ addNoteForRecordIndentError $
4250− [ D.fillSep $
4225+ D.fillSep $
4251− ["Try","putting","something","like"
4226+ ["Try","putting","something","like"
4252− ,D.dullyellow "42","or",D.dullyellow"\"hello\"","for","now?"
4227+ ,D.dullyellow "42","or",D.dullyellow"\"hello\"","for","now?"
4254− , noteForRecordIndentError
@@ -4273,9 +4246,11 @@ noteForRecordError =
4276−noteForRecordIndentError :: D.Doc
4249+addNoteForRecordIndentError :: D.Doc -> D.Doc
4277−noteForRecordIndentError =
4250+addNoteForRecordIndentError normalRecommendation =
4278− D.stack
4251+ D.stack $
4252+ normalRecommendation
4279 [ D.toSimpleNote
4254 [ D.toSimpleNote
4280 "I may be confused by indentation. For example, if you are trying to define\
4255 "I may be confused by indentation. For example, if you are trying to define\
4281 \ a record across multiple lines, I recommend using this format:"
4256 \ a record across multiple lines, I recommend using this format:"