@@ -191,7 +191,7 @@ toPatternReport source localizer patternRegion category tipe expected =
191 ( "This pattern is being used in an unexpected way:"
191 ( "This pattern is being used in an unexpected way:"
192 , patternTypeComparison localizer tipe expectedType
192 , patternTypeComparison localizer tipe expectedType
193 (addPatternCategory "It is" category)
193 (addPatternCategory "It is" category)
194− (singular "But it needs to match")
194+ "But it needs to match:"
@@ -203,9 +203,8 @@ toPatternReport source localizer patternRegion category tipe expected =
203 "The " <> D.ordinal index <> " argument to `" <> N.toString name <> "` is weird."
203 "The " <> D.ordinal index <> " argument to `" <> N.toString name <> "` is weird."
204 , patternTypeComparison localizer tipe expectedType
204 , patternTypeComparison localizer tipe expectedType
205 (addPatternCategory "The argument is a pattern that matches" category)
205 (addPatternCategory "The argument is a pattern that matches" category)
207− "But the type annotation on `" <> N.toString name
206+ ( "But the type annotation on `" <> N.toString name
208− <> "` says the " <> D.ordinal index <> " argument should be"
207+ <> "` says the " <> D.ordinal index <> " argument should be:"
@@ -218,7 +217,7 @@ toPatternReport source localizer patternRegion category tipe expected =
219 patternTypeComparison localizer tipe expectedType
218 patternTypeComparison localizer tipe expectedType
220 (addPatternCategory "The first pattern is trying to match" category)
219 (addPatternCategory "The first pattern is trying to match" category)
221− (singular "But the expression between `case` and `of` is")
220+ "But the expression between `case` and `of` is:"
222 [ D.reflow $
221 [ D.reflow $
223 "These can never match! Is the pattern the problem? Or is it the expression?"
222 "These can never match! Is the pattern the problem? Or is it the expression?"
@@ -228,7 +227,7 @@ toPatternReport source localizer patternRegion category tipe expected =
228 "The " <> D.ordinal index <> " pattern in this `case` does not match the previous ones."
227 "The " <> D.ordinal index <> " pattern in this `case` does not match the previous ones."
229 , patternTypeComparison localizer tipe expectedType
228 , patternTypeComparison localizer tipe expectedType
230 (addPatternCategory ("The " <> D.ordinal index <> " pattern is trying to match") category)
229 (addPatternCategory ("The " <> D.ordinal index <> " pattern is trying to match") category)
231− (plural "But all the previous patterns match")
230+ "But all the previous patterns match:"
232 [ D.link "Note"
231 [ D.link "Note"
233 "A `case` expression can only handle one type of value, so you may want to use"
232 "A `case` expression can only handle one type of value, so you may want to use"
234 "union-types"
233 "union-types"
@@ -241,9 +240,8 @@ toPatternReport source localizer patternRegion category tipe expected =
241 "The " <> D.ordinal index <> " argument to `" <> N.toString name <> "` is weird."
240 "The " <> D.ordinal index <> " argument to `" <> N.toString name <> "` is weird."
242 , patternTypeComparison localizer tipe expectedType
241 , patternTypeComparison localizer tipe expectedType
243 (addPatternCategory "It is trying to match" category)
242 (addPatternCategory "It is trying to match" category)
245− "But `" <> N.toString name <> "` needs its "
243+ ( "But `" <> N.toString name <> "` needs its "
246− <> D.ordinal index <> " argument to be"
244+ <> D.ordinal index <> " argument to be:"
@@ -253,7 +251,7 @@ toPatternReport source localizer patternRegion category tipe expected =
253 "The " <> D.ordinal index <> " pattern in this list does not match all the previous ones:"
251 "The " <> D.ordinal index <> " pattern in this list does not match all the previous ones:"
254 , patternTypeComparison localizer tipe expectedType
252 , patternTypeComparison localizer tipe expectedType
255 (addPatternCategory ("The " <> D.ordinal index <> " pattern is trying to match") category)
253 (addPatternCategory ("The " <> D.ordinal index <> " pattern is trying to match") category)
256− (plural "But all the previous patterns in the list are")
254+ "But all the previous patterns in the list are:"
257 [ D.toSimpleHint $
255 [ D.toSimpleHint $
258 "Everything in the list needs to be the same type of value.\
256 "Everything in the list needs to be the same type of value.\
259 \ This way you never run into unexpected values partway through.\
257 \ This way you never run into unexpected values partway through.\
@@ -267,7 +265,7 @@ toPatternReport source localizer patternRegion category tipe expected =
267 "The pattern after (::) is causing issues."
265 "The pattern after (::) is causing issues."
268 , patternTypeComparison localizer tipe expectedType
266 , patternTypeComparison localizer tipe expectedType
269 (addPatternCategory "The pattern after (::) is trying to match" category)
267 (addPatternCategory "The pattern after (::) is trying to match" category)
270− (\_ -> "But it needs to match lists like this:")
268+ "But it needs to match lists like this:"
@@ -276,144 +274,96 @@ toPatternReport source localizer patternRegion category tipe expected =
276-- PATTERN HELPERS
274-- PATTERN HELPERS
279−patternTypeComparison
277+patternTypeComparison :: L.Localizer -> T.Type -> T.Type -> String -> String -> [D.Doc] -> D.Doc
283− -> (Maybe N.Name -> D.Doc)
284− -> (Maybe N.Name -> D.Doc)
287patternTypeComparison localizer actual expected iAmSeeing insteadOf contextHints =
278patternTypeComparison localizer actual expected iAmSeeing insteadOf contextHints =
289− (T.Comparison actualAlias actualDoc expectedAlias expectedDoc problems) =
280+ (actualDoc, expectedDoc, problems) =
290 T.toComparison localizer actual expected
281 T.toComparison localizer actual expected
292 D.stack $
283 D.stack $
293− [ iAmSeeing actualAlias
284+ [ D.reflow iAmSeeing
294 , D.indent 4 actualDoc
285 , D.indent 4 actualDoc
295− , insteadOf expectedAlias
286+ , D.reflow insteadOf
296 , D.indent 4 expectedDoc
287 , D.indent 4 expectedDoc
298 ++ problemsToHint problems
289 ++ problemsToHint problems
299 ++ contextHints
290 ++ contextHints
302−addPatternCategory :: String -> PCategory -> Maybe N.Name -> D.Doc
293+addPatternCategory :: String -> PCategory -> String
303−addPatternCategory iAmTryingToMatch category maybeAlias =
294+addPatternCategory iAmTryingToMatch category =
304− D.reflow $ iAmTryingToMatch <>
295+ iAmTryingToMatch <>
307− " `" <> N.toString alias <> "` values:"
310− case category of
296+ case category of
311− PRecord -> " record values of type:"
297+ PRecord -> " record values of type:"
312− PUnit -> " unit values:"
298+ PUnit -> " unit values:"
313− PTuple -> " tuples of type:"
299+ PTuple -> " tuples of type:"
314− PList -> " lists of type:"
300+ PList -> " lists of type:"
315− PCtor name -> " `" <> N.toString name <> "` values of type:"
301+ PCtor name -> " `" <> N.toString name <> "` values of type:"
316− PInt -> " integers:"
302+ PInt -> " integers:"
317− PStr -> " strings:"
303+ PStr -> " strings:"
318− PChr -> " characters:"
304+ PChr -> " characters:"
322-- EXPR HELPERS
308-- EXPR HELPERS
325−typeComparison
311+typeComparison :: L.Localizer -> T.Type -> T.Type -> String -> String -> [D.Doc] -> D.Doc
329− -> (Maybe N.Name -> D.Doc)
330− -> (Maybe N.Name -> D.Doc)
333typeComparison localizer actual expected iAmSeeing insteadOf contextHints =
312typeComparison localizer actual expected iAmSeeing insteadOf contextHints =
335− (T.Comparison actualAlias actualDoc expectedAlias expectedDoc problems) =
314+ (actualDoc, expectedDoc, problems) =
336 T.toComparison localizer actual expected
315 T.toComparison localizer actual expected
338 D.stack $
317 D.stack $
339− [ iAmSeeing actualAlias
318+ [ D.reflow iAmSeeing
340 , D.indent 4 actualDoc
319 , D.indent 4 actualDoc
341− , insteadOf expectedAlias
320+ , D.reflow insteadOf
342 , D.indent 4 expectedDoc
321 , D.indent 4 expectedDoc
344 ++ problemsToHint problems
323 ++ problemsToHint problems
345 ++ contextHints
324 ++ contextHints
349− :: L.Localizer
327+loneType :: L.Localizer -> T.Type -> T.Type -> D.Doc -> [D.Doc] -> D.Doc
352− -> (Maybe N.Name -> D.Doc)
355loneType localizer actual expected iAmSeeing furtherDetails =
328loneType localizer actual expected iAmSeeing furtherDetails =
357− (T.Comparison actualAlias actualDoc _ _ problems) =
330+ (actualDoc, _, problems) =
358 T.toComparison localizer actual expected
331 T.toComparison localizer actual expected
360 D.stack $
333 D.stack $
361− [ iAmSeeing actualAlias
334+ [ iAmSeeing
362 , D.indent 4 actualDoc
335 , D.indent 4 actualDoc
364 ++ furtherDetails
337 ++ furtherDetails
365 ++ problemsToHint problems
338 ++ problemsToHint problems
368−singular :: String -> Maybe N.Name -> D.Doc
369−singular insteadOf maybeAlias =
370− D.reflow $ insteadOf <>
373− Just a -> " a `" <> N.toString a <> "` value:"
376−plural :: String -> Maybe N.Name -> D.Doc
377−plural insteadOf maybeAlias =
378− D.reflow $ insteadOf <>
381− Just a -> " `" <> N.toString a <> "` values:"
384−addCategory :: String -> Category -> Maybe N.Name -> D.Doc
341+addCategory :: String -> Category -> String
385−addCategory thisIs category maybeAlias =
342+addCategory thisIs category =
387− definitely whatever =
389− Just alias -> " a `" <> N.toString alias <> "`:"
393 case category of
343 case category of
394− Local name -> "This `" <> N.toString name <> "` value is" <> definitely " a:"
344+ Local name -> "This `" <> N.toString name <> "` value is a:"
395− Foreign name -> "This `" <> N.toString name <> "` value is" <> definitely " a:"
345+ Foreign name -> "This `" <> N.toString name <> "` value is a:"
396− Access field -> "The value at ." <> N.toString field <> " is" <> definitely " a:"
346+ Access field -> "The value at ." <> N.toString field <> " is a:"
397 Accessor field -> "This ." <> N.toString field <> " field access function has type:"
347 Accessor field -> "This ." <> N.toString field <> " field access function has type:"
398− If -> "This `if` expression produces" <> definitely ":"
348+ If -> "This `if` expression produces:"
399− Case -> "This `case` expression produces" <> definitely ":"
349+ Case -> "This `case` expression produces:"
400− List -> thisIs <> definitely " a list of type:"
350+ List -> thisIs <> " a list of type:"
401− Number -> thisIs <> definitely " a number of type:"
351+ Number -> thisIs <> " a number of type:"
402− Float -> thisIs <> definitely " a float of type:"
352+ Float -> thisIs <> " a float of type:"
403− String -> thisIs <> definitely " a string of type:"
353+ String -> thisIs <> " a string of type:"
404− Char -> thisIs <> definitely " a character of type:"
354+ Char -> thisIs <> " a character of type:"
405− Lambda -> thisIs <> definitely " an anonymous function of type:"
355+ Lambda -> thisIs <> " an anonymous function of type:"
406− Record -> thisIs <> definitely " a record of type:"
356+ Record -> thisIs <> " a record of type:"
407− Tuple -> thisIs <> definitely " a tuple of type:"
357+ Tuple -> thisIs <> " a tuple of type:"
408− Unit -> thisIs <> definitely " a unit value:"
358+ Unit -> thisIs <> " a unit value:"
409− Shader -> thisIs <> definitely " a GLSL shader of type:"
359+ Shader -> thisIs <> " a GLSL shader of type:"
410 Effects -> thisIs <> " a thing for CORE LIBRARIES ONLY."
360 Effects -> thisIs <> " a thing for CORE LIBRARIES ONLY."
411 CallResult maybeName ->
361 CallResult maybeName ->
412 case maybeName of
362 case maybeName of
413 NoName -> thisIs <> ":"
363 NoName -> thisIs <> ":"
414− FuncName name -> "This `" <> N.toString name <> "` call produces" <> definitely ":"
364+ FuncName name -> "This `" <> N.toString name <> "` call produces:"
415− CtorName name -> "This `" <> N.toString name <> "` call produces" <> definitely ":"
365+ CtorName name -> "This `" <> N.toString name <> "` call produces:"
416− OpName _ -> thisIs <> definitely ":"
366+ OpName _ -> thisIs <> ":"
419problemsToHint :: [T.Problem] -> [D.Doc]
369problemsToHint :: [T.Problem] -> [D.Doc]
@@ -531,6 +481,19 @@ problemToHint problem =
531 T.Tuple _ _ _ -> badRigidSuper super "a tuple"
481 T.Tuple _ _ _ -> badRigidSuper super "a tuple"
532 T.Alias _ n _ _ -> badRigidSuper super ("a `" ++ N.toString n ++ "` value")
482 T.Alias _ n _ _ -> badRigidSuper super ("a `" ++ N.toString n ++ "` value")
484+ T.FieldTypo typo possibilities ->
485+ case Suggest.sort (N.toString typo) N.toString possibilities of
491+ ["Seems","like","a","record","field","typo.","Maybe"
492+ ,D.dullyellow (D.fromName typo),"should","be"
493+ ,D.green (D.fromName nearest) <> "?"
536-- BAD RIGID HINTS
499-- BAD RIGID HINTS
@@ -659,7 +622,7 @@ toExprReport source localizer exprRegion category tipe expected =
659 ( "This expression is being used in an unexpected way:"
622 ( "This expression is being used in an unexpected way:"
660 , typeComparison localizer tipe expectedType
623 , typeComparison localizer tipe expectedType
661 (addCategory "It is" category)
624 (addCategory "It is" category)
662− (singular "But you are trying to use it as")
625+ "But you are trying to use it as:"
@@ -682,7 +645,7 @@ toExprReport source localizer exprRegion category tipe expected =
682 ( D.reflow ("Something is off with the " <> thing)
645 ( D.reflow ("Something is off with the " <> thing)
683 , typeComparison localizer tipe expectedType
646 , typeComparison localizer tipe expectedType
684 (addCategory itIs category)
647 (addCategory itIs category)
685− (singular $ "But the type annotation on `" <> N.toString name <> "` says it should be")
648+ ("But the type annotation on `" <> N.toString name <> "` says it should be:")
@@ -699,7 +662,7 @@ toExprReport source localizer exprRegion category tipe expected =
699 Report.Report "TYPE MISMATCH" exprRegion [] $
662 Report.Report "TYPE MISMATCH" exprRegion [] $
700 Report.toCodeSnippet source region maybeHighlight
663 Report.toCodeSnippet source region maybeHighlight
701 ( D.reflow problem
664 ( D.reflow problem
702− , loneType localizer tipe expectedType (addCategory thisIs category) furtherDetails
665+ , loneType localizer tipe expectedType (D.reflow (addCategory thisIs category)) furtherDetails
705 custom maybeHighlight docPair =
668 custom maybeHighlight docPair =
@@ -713,7 +676,7 @@ toExprReport source localizer exprRegion category tipe expected =
713 ( Just exprRegion
676 ( Just exprRegion
714 , "The " <> ith <> " element of this list does not match all the previous elements:"
677 , "The " <> ith <> " element of this list does not match all the previous elements:"
715 , "The " <> ith <> " element is"
678 , "The " <> ith <> " element is"
716− , plural "But all the previous elements in the list are"
679+ , "But all the previous elements in the list are:"
717 , [ D.toSimpleHint $
680 , [ D.toSimpleHint $
718 "Everything in the list needs to be the same type of value.\
681 "Everything in the list needs to be the same type of value.\
719 \ This way you never run into unexpected values partway through.\
682 \ This way you never run into unexpected values partway through.\
@@ -761,7 +724,7 @@ toExprReport source localizer exprRegion category tipe expected =
761 ( Just exprRegion
724 ( Just exprRegion
762 , "The " <> ith <> " branch of this `if` does not match all the previous branches:"
725 , "The " <> ith <> " branch of this `if` does not match all the previous branches:"
763 , "The " <> ith <> " branch is"
726 , "The " <> ith <> " branch is"
764− , plural "But all the previous branches result in"
727+ , "But all the previous branches result in:"
765 , [ D.link "Hint"
728 , [ D.link "Hint"
766 "All branches in an `if` must produce the same type of values. This way, no\
729 "All branches in an `if` must produce the same type of values. This way, no\
767 \ matter which branch we take, the result is always a consistent shape. Read"
730 \ matter which branch we take, the result is always a consistent shape. Read"
@@ -776,7 +739,7 @@ toExprReport source localizer exprRegion category tipe expected =
776 ( Just exprRegion
739 ( Just exprRegion
777 , "The " <> ith <> " branch of this `case` does not match all the previous branches:"
740 , "The " <> ith <> " branch of this `case` does not match all the previous branches:"
778 , "The " <> ith <> " branch is"
741 , "The " <> ith <> " branch is"
779− , plural "But all the previous branches result in"
742+ , "But all the previous branches result in:"
780 , [ D.link "Hint"
743 , [ D.link "Hint"
781 "All branches in a `case` must produce the same type of values. This way, no\
744 "All branches in a `case` must produce the same type of values. This way, no\
782 \ matter which branch we take, the result is always a consistent shape. Read"
745 \ matter which branch we take, the result is always a consistent shape. Read"
@@ -830,7 +793,7 @@ toExprReport source localizer exprRegion category tipe expected =
830 ( Just exprRegion
793 ( Just exprRegion
831 , "The " <> ith <> " argument to " <> thisFunction <> " is not what I expect:"
794 , "The " <> ith <> " argument to " <> thisFunction <> " is not what I expect:"
832 , "This argument is"
795 , "This argument is"
833− , singular $ "But " <> thisFunction <> " needs the " <> ith <> " argument to be"
796+ , "But " <> thisFunction <> " needs the " <> ith <> " argument to be:"
835 if Index.toHuman index == 1 then
798 if Index.toHuman index == 1 then
@@ -884,7 +847,7 @@ toExprReport source localizer exprRegion category tipe expected =
884 ( Nothing
847 ( Nothing
885 , "Something is off with this record update:"
848 , "Something is off with this record update:"
886 , "The `" <> N.toString record <> "` record is"
849 , "The `" <> N.toString record <> "` record is"
887− , \_ -> "But this update needs it to be compatable with:"
850+ , "But this update needs it to be compatable with:"
888 , [ D.reflow
851 , [ D.reflow
889 "Do you mind creating an <http://sscce.org/> that produces this error message and\
852 "Do you mind creating an <http://sscce.org/> that produces this error message and\
890 \ sharing it at <https://github.com/elm-lang/error-message-catalog/issues> so we\
853 \ sharing it at <https://github.com/elm-lang/error-message-catalog/issues> so we\
@@ -929,7 +892,7 @@ toExprReport source localizer exprRegion category tipe expected =
929 ( Just exprRegion
892 ( Just exprRegion
930 , "I cannot update the `" <> N.toString field <> "` field like this:"
893 , "I cannot update the `" <> N.toString field <> "` field like this:"
931 , "You are trying to update `" <> N.toString field <> "` to be"
894 , "You are trying to update `" <> N.toString field <> "` to be"
932− , singular "But it should be"
895+ , "But it should be:"
933 , [ D.toSimpleNote
896 , [ D.toSimpleNote
934 "The record update syntax does not allow you to change the type of fields.\
897 "The record update syntax does not allow you to change the type of fields.\
935 \ You can achieve that with record constructors or the record literal syntax."
898 \ You can achieve that with record constructors or the record literal syntax."
@@ -941,7 +904,7 @@ toExprReport source localizer exprRegion category tipe expected =
941 ( Nothing
904 ( Nothing
942 , "This definition is causing issues:"
905 , "This definition is causing issues:"
943 , "You are defining"
906 , "You are defining"
944− , singular "But then trying to destructure it as"
907+ , "But then trying to destructure it as:"
@@ -1030,7 +993,7 @@ opLeftToDocs localizer category op tipe expected =
1031 ( "The left side of (<|) needs to be a function so I can pipe arguments to it!"
994 ( "The left side of (<|) needs to be a function so I can pipe arguments to it!"
1032 , loneType localizer tipe expected
995 , loneType localizer tipe expected
1033− (addCategory "I am seeing" category)
996+ (D.reflow (addCategory "I am seeing" category))
1034 [ D.reflow $ "This needs to be some kind of function though!"
997 [ D.reflow $ "This needs to be some kind of function though!"
@@ -1040,7 +1003,7 @@ opLeftToDocs localizer category op tipe expected =
1040 "The left argument of (" <> N.toString op <> ") is causing problems:"
1003 "The left argument of (" <> N.toString op <> ") is causing problems:"
1041 , typeComparison localizer tipe expected
1004 , typeComparison localizer tipe expected
1042 (addCategory "The left argument is" category)
1005 (addCategory "The left argument is" category)
1043− (singular $ "But (" <> N.toString op <> ") needs the left argument to be")
1006+ ("But (" <> N.toString op <> ") needs the left argument to be:")
@@ -1101,7 +1064,7 @@ opRightToDocs localizer category op tipe expected =
1101 ( D.reflow $ "I cannot send this through the (<|) pipe:"
1064 ( D.reflow $ "I cannot send this through the (<|) pipe:"
1102 , typeComparison localizer tipe expected
1065 , typeComparison localizer tipe expected
1103 (addCategory "You are providing" category)
1066 (addCategory "You are providing" category)
1104− (singular "But (<|) is piping it a function that expects")
1067+ "But (<|) is piping it a function that expects:"
@@ -1112,7 +1075,7 @@ opRightToDocs localizer category op tipe expected =
1112 ( D.reflow $ "This function cannot handle the argument sent through the (|>) pipe:"
1075 ( D.reflow $ "This function cannot handle the argument sent through the (|>) pipe:"
1113 , typeComparison localizer argType expectedArgType
1076 , typeComparison localizer argType expectedArgType
1114 (addCategory "The argument is" category)
1077 (addCategory "The argument is" category)
1115− (singular "But (|>) is piping it a function that expects")
1078+ "But (|>) is piping it a function that expects:"
@@ -1120,7 +1083,7 @@ opRightToDocs localizer category op tipe expected =
1120 EmphRight
1083 EmphRight
1121 ( D.reflow $ "The right side of (|>) needs to be a function so I can pipe arguments to it!"
1084 ( D.reflow $ "The right side of (|>) needs to be a function so I can pipe arguments to it!"
1122 , loneType localizer tipe expected
1085 , loneType localizer tipe expected
1123− (addCategory "But instead of a function, I am seeing" category)
1086+ (D.reflow (addCategory "But instead of a function, I am seeing" category))
@@ -1135,7 +1098,7 @@ badOpRightFallback localizer category op tipe expected =
1135 "The right argument of (" <> N.toString op <> ") is causing problems."
1098 "The right argument of (" <> N.toString op <> ") is causing problems."
1136 , typeComparison localizer tipe expected
1099 , typeComparison localizer tipe expected
1137 (addCategory "The right argument is" category)
1100 (addCategory "The right argument is" category)
1138− (singular $ "But (" <> N.toString op <> ") needs the right argument to be")
1101+ ("But (" <> N.toString op <> ") needs the right argument to be:")
1139 [ D.toSimpleHint $
1102 [ D.toSimpleHint $
1140 "With operators like (" ++ N.toString op ++ ") I always check the left\
1103 "With operators like (" ++ N.toString op ++ ") I always check the left\
1141 \ side first. If it seems fine, I assume it is correct and check the right\
1104 \ side first. If it seems fine, I assume it is correct and check the right\
@@ -1197,8 +1160,8 @@ badConsRight localizer category tipe expected =
1197 EmphBoth
1160 EmphBoth
1198 ( D.reflow "I am having trouble with this (::) operator:"
1161 ( D.reflow "I am having trouble with this (::) operator:"
1199 , typeComparison localizer expectedElement actualElement
1162 , typeComparison localizer expectedElement actualElement
1200− (singular "The left side of (::) is")
1163+ "The left side of (::) is:"
1201− (plural "But you are trying to put that into a list filled with")
1164+ "But you are trying to put that into a list filled with:"
1202 ( case expectedElement of
1165 ( case expectedElement of
1203 T.Type home name [_] | T.isList home name ->
1166 T.Type home name [_] | T.isList home name ->
1204 [ D.toSimpleHint
1167 [ D.toSimpleHint
@@ -1221,7 +1184,7 @@ badConsRight localizer category tipe expected =
1221 EmphRight
1184 EmphRight
1222 ( D.reflow "The (::) operator can only add elements onto lists."
1185 ( D.reflow "The (::) operator can only add elements onto lists."
1223 , loneType localizer tipe expected
1186 , loneType localizer tipe expected
1224− (addCategory "The right side is" category)
1187+ (D.reflow (addCategory "The right side is" category))
1225 [D.fillSep ["But","(::)","needs","a",D.dullyellow "List","on","the","right."]
1188 [D.fillSep ["But","(::)","needs","a",D.dullyellow "List","on","the","right."]
@@ -1271,7 +1234,7 @@ badAppendLeft localizer category tipe expected =
1271 ( D.reflow $
1234 ( D.reflow $
1272 "The (++) operator cannot append this type of value:"
1235 "The (++) operator cannot append this type of value:"
1273 , loneType localizer tipe expected
1236 , loneType localizer tipe expected
1274− (addCategory "I am seeing" category)
1237+ (D.reflow (addCategory "I am seeing" category))
1275 [ D.fillSep
1238 [ D.fillSep
1276 ["But","the","(++)","operator","is","only","for","appending"
1239 ["But","the","(++)","operator","is","only","for","appending"
1277 ,D.dullyellow "List","and",D.dullyellow "String","values."
1240 ,D.dullyellow "List","and",D.dullyellow "String","values."
@@ -1330,7 +1293,7 @@ badAppendRight localizer category tipe expected =
1330 ( D.reflow $
1293 ( D.reflow $
1331 "The (++) operator cannot append these two values:"
1294 "The (++) operator cannot append these two values:"
1332 , typeComparison localizer expected tipe
1295 , typeComparison localizer expected tipe
1333− (singular "I already figured out that the left side of (++) is")
1296+ "I already figured out that the left side of (++) is:"
1334 (addCategory "But this clashes with the right side, which is" category)
1297 (addCategory "But this clashes with the right side, which is" category)
@@ -1402,7 +1365,7 @@ badListAdd localizer category direction tipe expected =
1402 "I cannot do addition with lists:"
1365 "I cannot do addition with lists:"
1404 loneType localizer tipe expected
1367 loneType localizer tipe expected
1405− (addCategory ("The " <> direction <> " side of (+) is") category)
1368+ (D.reflow (addCategory ("The " <> direction <> " side of (+) is") category))
1406 [ D.fillSep
1369 [ D.fillSep
1407 ["But","(+)","only","works","with",D.dullyellow "Int","and",D.dullyellow "Float","values."
1370 ["But","(+)","only","works","with",D.dullyellow "Int","and",D.dullyellow "Float","values."
@@ -1432,7 +1395,7 @@ badMath localizer category operation direction op tipe expected otherHints =
1432 operation ++ " does not work with this value:"
1395 operation ++ " does not work with this value:"
1434 loneType localizer tipe expected
1397 loneType localizer tipe expected
1435− (addCategory ("The " <> direction <> " side of (" <> op <> ") is") category)
1398+ (D.reflow (addCategory ("The " <> direction <> " side of (" <> op <> ") is") category))
1436 ( [ D.fillSep
1399 ( [ D.fillSep
1437 ["But","(" <> D.fromString op <> ")","only","works","with"
1400 ["But","(" <> D.fromString op <> ")","only","works","with"
1438 ,D.dullyellow "Int","and",D.dullyellow "Float","values."
1401 ,D.dullyellow "Int","and",D.dullyellow "Float","values."
@@ -1466,11 +1429,10 @@ badFDiv localizer direction tipe expected =
1468 loneType localizer tipe expected
1431 loneType localizer tipe expected
1470− D.fillSep
1432+ (D.fillSep
1471− ["The",direction,"side","of","(/)","must","be","a"
1433+ ["The",direction,"side","of","(/)","must","be","a"
1472− ,D.dullyellow "Float" <> ",","but","instead","I","am","seeing:"
1434+ ,D.dullyellow "Float" <> ",","but","instead","I","am","seeing:"
@@ -1501,11 +1463,10 @@ badIDiv localizer direction tipe expected =
1503 loneType localizer tipe expected
1465 loneType localizer tipe expected
1505− D.fillSep
1466+ ( D.fillSep
1506− ["The",direction,"side","of","(//)","must","be","an"
1467+ ["The",direction,"side","of","(//)","must","be","an"
1507− ,D.dullyellow "Int" <> ",","but","instead","I","am","seeing:"
1468+ ,D.dullyellow "Int" <> ",","but","instead","I","am","seeing:"
@@ -1522,11 +1483,10 @@ badBool localizer op direction tipe expected =
1522 "I am struggling with this boolean operation:"
1483 "I am struggling with this boolean operation:"
1524 loneType localizer tipe expected
1485 loneType localizer tipe expected
1526− D.fillSep
1486+ ( D.fillSep
1527− ["Both","sides","of","(" <> op <> ")","must","be"
1487+ ["Both","sides","of","(" <> op <> ")","must","be"
1528− ,D.dullyellow "Bool","values,","but","the",direction,"side","is:"
1488+ ,D.dullyellow "Bool","values,","but","the",direction,"side","is:"
@@ -1543,7 +1503,7 @@ badCompLeft localizer category op direction tipe expected =
1543 "I cannot do a comparison with this value:"
1503 "I cannot do a comparison with this value:"
1545 loneType localizer tipe expected
1505 loneType localizer tipe expected
1546− (addCategory ("The " <> direction <> " side of (" <> op <> ") is") category)
1506+ (D.reflow (addCategory ("The " <> direction <> " side of (" <> op <> ") is") category))
1547 [ D.fillSep
1507 [ D.fillSep
1548 ["But","(" <> D.fromString op <> ")","only","works","on"
1508 ["But","(" <> D.fromString op <> ")","only","works","on"
1549 ,D.dullyellow "Int" <> ","
1509 ,D.dullyellow "Int" <> ","
@@ -1567,8 +1527,8 @@ badCompRight localizer op tipe expected =
1567 "I need both sides of (" <> op <> ") to be the same type:"
1527 "I need both sides of (" <> op <> ") to be the same type:"
1569 typeComparison localizer expected tipe
1529 typeComparison localizer expected tipe
1570− (singular "The left side of is")
1530+ "The left side of is:"
1571− (singular "But the right side is")
1531+ "But the right side is:"
1572 [ D.reflow $
1532 [ D.reflow $
1573 "I cannot compare different types though! Which side of (" <> op <> ") is the problem?"
1533 "I cannot compare different types though! Which side of (" <> op <> ") is the problem?"
@@ -1587,8 +1547,8 @@ badEquality localizer op tipe expected =
1587 "I need both sides of (" <> op <> ") to be the same type:"
1547 "I need both sides of (" <> op <> ") to be the same type:"
1589 typeComparison localizer expected tipe
1549 typeComparison localizer expected tipe
1590− (singular "The left side of is")
1550+ "The left side of is:"
1591− (singular "But the right side is")
1551+ "But the right side is:"
1592 [ if isFloat tipe || isFloat expected then
1552 [ if isFloat tipe || isFloat expected then
1593 D.toSimpleNote $
1553 D.toSimpleNote $
1594 "Equality on floats is not 100% reliable due to the design of IEEE 754. I\
1554 "Equality on floats is not 100% reliable due to the design of IEEE 754. I\