on master help sign in
switch addNoteForRecordError to noteForRecordError

This is just switching to the convention that I settled on for notes. The code before turned out to be harder to read than just using D.stack directly.

commitb2bb05d46a3c8137cfa2e306c2f68ff864df8b24 authorEvan Czaplicki <evancz@users.noreply.github.com> dateThu 25 Jul 2019, 17:57 (7 years ago) parent00ee154
1 file changed+23−19
compiler/src/Reporting/Error/Syntax.hs+23−19
compiler/src/Reporting/Error/Syntax.hs+23−19
@@ -3883,11 +3883,13 @@ toRecordReport source context record startRow startCol =
38833883 D.reflow $
38843884 "I am partway through parsing a record, but I got stuck after that last comma:"
38853885 ,
3886− addNoteForRecordError $
3887− D.reflow $
3888− "Trailing commas are not allowed in records, so I was expecting to see another\
3889− \ record field defined next. If you are done defining the record, the fix may\
3890− \ be to delete that last comma?"
3886+ D.stack
3887+ [ D.reflow $
3888+ "Trailing commas are not allowed in records, so I was expecting to see another\
3889+ \ record field defined next. If you are done defining the record, the fix may\
3890+ \ be to delete that last comma?"
3891+ , noteForRecordError
3892+ ]
38913893 )
38923894
38933895 RecordEquals row col ->
@@ -3901,11 +3903,13 @@ toRecordReport source context record startRow startCol =
39013903 D.reflow $
39023904 "I am partway through parsing a record, but I got stuck here:"
39033905 ,
3904− addNoteForRecordError $
3905− D.fillSep $
3906− ["I","just","saw","a","field","name,","so","I","was","expecting","to","see"
3907− ,"an","equals","sign","next.","So","try","putting","an",D.green "=","sign","here?"
3908− ]
3906+ D.stack
3907+ [ D.fillSep $
3908+ ["I","just","saw","a","field","name,","so","I","was","expecting","to","see"
3909+ ,"an","equals","sign","next.","So","try","putting","an",D.green "=","sign","here?"
3910+ ]
3911+ , noteForRecordError
3912+ ]
39093913 )
39103914
39113915 RecordExpr expr row col ->
@@ -3960,11 +3964,13 @@ toRecordReport source context record startRow startCol =
39603964 D.reflow $
39613965 "I am partway through parsing a record, but I got stuck after that last comma:"
39623966 ,
3963− addNoteForRecordError $
3964− D.reflow $
3965− "Trailing commas are not allowed in records, so the fix may be to\
3966− \ delete that last comma? Or maybe you were in the middle of defining\
3967− \ an additional field?"
3967+ D.stack
3968+ [ D.reflow $
3969+ "Trailing commas are not allowed in records, so the fix may be to\
3970+ \ delete that last comma? Or maybe you were in the middle of defining\
3971+ \ an additional field?"
3972+ , noteForRecordError
3973+ ]
39683974 )
39693975
39703976 RecordIndentEquals row col ->
@@ -4004,11 +4010,9 @@ toRecordReport source context record startRow startCol =
40044010 )
40054011
40064012
4007−addNoteForRecordError :: D.Doc -> D.Doc
4008−addNoteForRecordError normalRecommendation =
4013+noteForRecordError :: D.Doc
4014+noteForRecordError =
40094015 D.stack $
4010− normalRecommendation
4011− :
40124016 [ D.toSimpleNote
40134017 "If you are trying to define a record across multiple lines, I recommend using this format:"
40144018 , D.indent 4 $ D.vcat $