@@ -24,7 +24,7 @@ import Data.Monoid ((<>))
25import qualified Data.Index as Index
25import qualified Data.Index as Index
26import qualified Elm.Name as N
26import qualified Elm.Name as N
27−import qualified Reporting.Helpers as H
27+import qualified Reporting.Doc as D
28import qualified Reporting.Region as R
28import qualified Reporting.Region as R
29import qualified Reporting.Render.Code as Code
29import qualified Reporting.Render.Code as Code
30import qualified Reporting.Render.Type as RT
30import qualified Reporting.Render.Type as RT
@@ -202,15 +202,15 @@ toPatternReport source localizer patternRegion category tipe expected =
202 case context of
202 case context of
203 PTypedArg name index ->
203 PTypedArg name index ->
205− H.reflow $
205+ D.reflow $
206− "The " <> H.ordinalize (Index.toHuman index) <> " argument to `" <> N.toString name <> "` is weird."
206+ "The " <> D.ordinalize (Index.toHuman index) <> " argument to `" <> N.toString name <> "` is weird."
208 patternTypeComparison localizer tipe expectedType
208 patternTypeComparison localizer tipe expectedType
210 toPatternDescription category $
210 toPatternDescription category $
211 "The argument is a pattern that matches"
211 "The argument is a pattern that matches"
213− "But the type annotation on `" <> N.toString name <> "` says the " <> H.ordinalize (Index.toHuman index) <> " argument should be:"
213+ "But the type annotation on `" <> N.toString name <> "` says the " <> D.ordinalize (Index.toHuman index) <> " argument should be:"
@@ -219,7 +219,7 @@ toPatternReport source localizer patternRegion category tipe expected =
219 PCaseMatch index ->
219 PCaseMatch index ->
220 if index == Index.first then
220 if index == Index.first then
222− H.reflow $
222+ D.reflow $
223 "The 1st pattern in this `case` causing a mismatch:"
223 "The 1st pattern in this `case` causing a mismatch:"
225 patternTypeComparison localizer tipe expectedType
225 patternTypeComparison localizer tipe expectedType
@@ -228,20 +228,20 @@ toPatternReport source localizer patternRegion category tipe expected =
229 "But it is supposed to match an expression of type:"
229 "But it is supposed to match an expression of type:"
231− [ H.reflow $
231+ [ D.reflow $
232 "Is the pattern the problem? Or is it the expression you are trying to match on?"
232 "Is the pattern the problem? Or is it the expression you are trying to match on?"
238− H.reflow $
238+ D.reflow $
239− "The " <> H.ordinalize (Index.toHuman index) <> " pattern in this `case` does not match the previous ones."
239+ "The " <> D.ordinalize (Index.toHuman index) <> " pattern in this `case` does not match the previous ones."
241 patternTypeComparison localizer tipe expectedType
241 patternTypeComparison localizer tipe expectedType
243 toPatternDescription category $
243 toPatternDescription category $
244− "The " <> H.ordinalize (Index.toHuman index) <> " pattern is trying to match"
244+ "The " <> D.ordinalize (Index.toHuman index) <> " pattern is trying to match"
246 "But all the previous patterns match values of type:"
246 "But all the previous patterns match values of type:"
@@ -251,14 +251,14 @@ toPatternReport source localizer patternRegion category tipe expected =
252 PCtorArg name index ->
252 PCtorArg name index ->
254− H.reflow $
254+ D.reflow $
255− "The " <> H.ordinalize (Index.toHuman index) <> " argument to `" <> N.toString name <> "` is weird."
255+ "The " <> D.ordinalize (Index.toHuman index) <> " argument to `" <> N.toString name <> "` is weird."
257 patternTypeComparison localizer tipe expectedType
257 patternTypeComparison localizer tipe expectedType
259 toPatternDescription category "It is trying to match"
259 toPatternDescription category "It is trying to match"
261− "But `" <> N.toString name <> "` needs its " <> H.ordinalize (Index.toHuman index) <> " argument to be:"
261+ "But `" <> N.toString name <> "` needs its " <> D.ordinalize (Index.toHuman index) <> " argument to be:"
@@ -266,17 +266,17 @@ toPatternReport source localizer patternRegion category tipe expected =
267 PListEntry index ->
267 PListEntry index ->
269− H.reflow $
269+ D.reflow $
270− "The " <> H.ordinalize (Index.toHuman index) <> " pattern in this list does not match all the previous ones:"
270+ "The " <> D.ordinalize (Index.toHuman index) <> " pattern in this list does not match all the previous ones:"
272 patternTypeComparison localizer tipe expectedType
272 patternTypeComparison localizer tipe expectedType
274 toPatternDescription category $
274 toPatternDescription category $
275− "The " <> H.ordinalize (Index.toHuman index) <> " pattern is trying to match"
275+ "The " <> D.ordinalize (Index.toHuman index) <> " pattern is trying to match"
277 "But all the previous patterns in the list are:"
277 "But all the previous patterns in the list are:"
279− [ H.toSimpleHint $
279+ [ D.toSimpleHint $
280 "Everything in the list needs to be the same type of value.\
280 "Everything in the list needs to be the same type of value.\
281 \ This way you never run into unexpected values partway through.\
281 \ This way you never run into unexpected values partway through.\
282 \ To mix different types in a single list, create a \"union type\" as\
282 \ To mix different types in a single list, create a \"union type\" as\
@@ -287,7 +287,7 @@ toPatternReport source localizer patternRegion category tipe expected =
290− H.reflow $
290+ D.reflow $
291 "The pattern after (::) is causing issues."
291 "The pattern after (::) is causing issues."
293 patternTypeComparison localizer tipe expectedType
293 patternTypeComparison localizer tipe expectedType
@@ -306,17 +306,17 @@ toPatternReport source localizer patternRegion category tipe expected =
306-- PATTERN HELPERS
306-- PATTERN HELPERS
309−patternTypeComparison :: T.Localizer -> T.Type -> T.Type -> ( String, String, [H.Doc] ) -> H.Doc
309+patternTypeComparison :: T.Localizer -> T.Type -> T.Type -> ( String, String, [D.Doc] ) -> D.Doc
310patternTypeComparison localizer actual expected ( iAmSeeing, insteadOf, contextHints ) =
310patternTypeComparison localizer actual expected ( iAmSeeing, insteadOf, contextHints ) =
312 (actualDoc, expectedDoc, problems) =
312 (actualDoc, expectedDoc, problems) =
313 T.toDiffDocs localizer actual expected
313 T.toDiffDocs localizer actual expected
315− H.stack $
315+ D.stack $
316− [ H.reflow iAmSeeing
316+ [ D.reflow iAmSeeing
317− , H.indent 4 actualDoc
317+ , D.indent 4 actualDoc
318− , H.reflow insteadOf
318+ , D.reflow insteadOf
319− , H.indent 4 expectedDoc
319+ , D.indent 4 expectedDoc
321 ++ problemsToHint problems
321 ++ problemsToHint problems
322 ++ contextHints
322 ++ contextHints
@@ -340,31 +340,31 @@ toPatternDescription category iAmTryingToMatch =
340-- EXPR HELPERS
340-- EXPR HELPERS
343−typeComparison :: T.Localizer -> T.Type -> T.Type -> ( String, String, [H.Doc] ) -> H.Doc
343+typeComparison :: T.Localizer -> T.Type -> T.Type -> ( String, String, [D.Doc] ) -> D.Doc
344typeComparison localizer actual expected ( iAmSeeing, insteadOf, contextHints ) =
344typeComparison localizer actual expected ( iAmSeeing, insteadOf, contextHints ) =
346 (actualDoc, expectedDoc, problems) =
346 (actualDoc, expectedDoc, problems) =
347 T.toDiffDocs localizer actual expected
347 T.toDiffDocs localizer actual expected
349− H.stack $
349+ D.stack $
350− [ H.reflow iAmSeeing
350+ [ D.reflow iAmSeeing
351− , H.indent 4 actualDoc
351+ , D.indent 4 actualDoc
352− , H.reflow insteadOf
352+ , D.reflow insteadOf
353− , H.indent 4 expectedDoc
353+ , D.indent 4 expectedDoc
355 ++ problemsToHint problems
355 ++ problemsToHint problems
356 ++ contextHints
356 ++ contextHints
359−loneType :: T.Localizer -> T.Type -> T.Type -> ( H.Doc, [H.Doc] ) -> H.Doc
359+loneType :: T.Localizer -> T.Type -> T.Type -> ( D.Doc, [D.Doc] ) -> D.Doc
360loneType localizer actual expected ( iAmSeeing, furtherDetails ) =
360loneType localizer actual expected ( iAmSeeing, furtherDetails ) =
362 (actualDoc, _, problems) =
362 (actualDoc, _, problems) =
363 T.toDiffDocs localizer actual expected
363 T.toDiffDocs localizer actual expected
365− H.stack $
365+ D.stack $
366 [ iAmSeeing
366 [ iAmSeeing
367− , H.indent 4 actualDoc
367+ , D.indent 4 actualDoc
369 ++ furtherDetails
369 ++ furtherDetails
370 ++ problemsToHint problems
370 ++ problemsToHint problems
@@ -398,7 +398,7 @@ toDescription category thatThingIs =
398 OpName _ -> thatThingIs <> ":"
398 OpName _ -> thatThingIs <> ":"
401−problemsToHint :: [T.Problem] -> [H.Doc]
401+problemsToHint :: [T.Problem] -> [D.Doc]
402problemsToHint problems =
402problemsToHint problems =
403 case problems of
403 case problems of
@@ -408,63 +408,63 @@ problemsToHint problems =
408 problemToHint problem
408 problemToHint problem
411−problemToHint :: T.Problem -> [H.Doc]
411+problemToHint :: T.Problem -> [D.Doc]
412problemToHint problem =
412problemToHint problem =
413 case problem of
413 case problem of
414 T.FieldMismatch _ _ -> [] -- TODO do a better job?
414 T.FieldMismatch _ _ -> [] -- TODO do a better job?
416 T.IntFloat ->
416 T.IntFloat ->
417− [ H.fancyLink "Note" ["Read"] "implicit-casts"
417+ [ D.fancyLink "Note" ["Read"] "implicit-casts"
418 ["to","learn","why","Elm","does","not","implicitly","convert"
418 ["to","learn","why","Elm","does","not","implicitly","convert"
419− ,"Ints","to","Floats.","Use",H.green "toFloat","and"
419+ ,"Ints","to","Floats.","Use",D.green "toFloat","and"
420− ,H.green "round","to","do","explicit","conversions."
420+ ,D.green "round","to","do","explicit","conversions."
424 T.StringFromInt ->
424 T.StringFromInt ->
425− [ H.toFancyHint
425+ [ D.toFancyHint
426 ["Want","to","convert","an","Int","into","a","String?"
426 ["Want","to","convert","an","Int","into","a","String?"
427− ,"Use","the",H.green "String.fromInt","function!"
427+ ,"Use","the",D.green "String.fromInt","function!"
431 T.StringFromFloat ->
431 T.StringFromFloat ->
432− [ H.toFancyHint
432+ [ D.toFancyHint
433 ["Want","to","convert","a","Float","into","a","String?"
433 ["Want","to","convert","a","Float","into","a","String?"
434− ,"Use","the",H.green "String.fromFloat","function!"
434+ ,"Use","the",D.green "String.fromFloat","function!"
438 T.StringToInt ->
438 T.StringToInt ->
439− [ H.toFancyHint
439+ [ D.toFancyHint
440 ["Want","to","convert","a","String","into","an","Int?"
440 ["Want","to","convert","a","String","into","an","Int?"
441− ,"Use","the",H.green "String.toInt","function!"
441+ ,"Use","the",D.green "String.toInt","function!"
445 T.StringToFloat ->
445 T.StringToFloat ->
446− [ H.toFancyHint
446+ [ D.toFancyHint
447 ["Want","to","convert","a","String","into","a","Float?"
447 ["Want","to","convert","a","String","into","a","Float?"
448− ,"Use","the",H.green "String.toFloat","function!"
448+ ,"Use","the",D.green "String.toFloat","function!"
452 T.AnythingToBool ->
452 T.AnythingToBool ->
453− [ H.toSimpleHint $
453+ [ D.toSimpleHint $
454 "Elm does not have “truthiness” such that ints and strings and lists\
454 "Elm does not have “truthiness” such that ints and strings and lists\
455 \ are automatically converted to booleans. Do that conversion explicitly!"
455 \ are automatically converted to booleans. Do that conversion explicitly!"
458 T.AnythingFromMaybe ->
458 T.AnythingFromMaybe ->
459− [ H.toFancyHint
459+ [ D.toFancyHint
460− ["Use",H.green "Maybe.withDefault","to","handle","possible","errors."
460+ ["Use",D.green "Maybe.withDefault","to","handle","possible","errors."
461 ,"Longer","term,","it","is","usually","better","to","write","out","the"
461 ,"Longer","term,","it","is","usually","better","to","write","out","the"
462 ,"full","`case`","though!"
462 ,"full","`case`","though!"
466 T.AnythingToList ->
466 T.AnythingToList ->
467− [ H.toSimpleHint "Did you forget to add [] around it?"
467+ [ D.toSimpleHint "Did you forget to add [] around it?"
470 T.MissingArgs _ -> []
470 T.MissingArgs _ -> []
@@ -520,25 +520,25 @@ problemToHint problem =
520-- BAD RIGID HINTS
520-- BAD RIGID HINTS
523−badRigidVar :: N.Name -> String -> [H.Doc]
523+badRigidVar :: N.Name -> String -> [D.Doc]
524badRigidVar name aThing =
524badRigidVar name aThing =
525− [ H.toSimpleHint $
525+ [ D.toSimpleHint $
526 "Your type annotation uses type variable `" ++ N.toString name ++
526 "Your type annotation uses type variable `" ++ N.toString name ++
527 "` which means ANY type of value can flow through, but your code is saying it specifically wants "
527 "` which means ANY type of value can flow through, but your code is saying it specifically wants "
528 ++ aThing ++ ". Maybe change your type annotation to\
528 ++ aThing ++ ". Maybe change your type annotation to\
529 \ be more specific? Maybe change the code to be more general?"
529 \ be more specific? Maybe change the code to be more general?"
530− , H.reflowLink "Read" "type-annotations" "for more advice!"
530+ , D.reflowLink "Read" "type-annotations" "for more advice!"
534−badDoubleRigid :: N.Name -> N.Name -> [H.Doc]
534+badDoubleRigid :: N.Name -> N.Name -> [D.Doc]
535badDoubleRigid x y =
535badDoubleRigid x y =
536− [ H.toSimpleHint $
536+ [ D.toSimpleHint $
537 "Your type annotation uses `" ++ N.toString x ++ "` and `" ++ N.toString y ++
537 "Your type annotation uses `" ++ N.toString x ++ "` and `" ++ N.toString y ++
538 "` as separate type variables. Your code seems to be saying they are the\
538 "` as separate type variables. Your code seems to be saying they are the\
539 \ same though! Maybe they should be the same in your type annotation?\
539 \ same though! Maybe they should be the same in your type annotation?\
540 \ Maybe your code uses them in a weird way?"
540 \ Maybe your code uses them in a weird way?"
541− , H.reflowLink "Read" "type-annotations" "for more advice!"
541+ , D.reflowLink "Read" "type-annotations" "for more advice!"
@@ -555,47 +555,47 @@ toASuperThing super =
555-- BAD SUPER HINTS
555-- BAD SUPER HINTS
558−badFlexSuper :: T.Super -> T.Type -> [H.Doc]
558+badFlexSuper :: T.Super -> T.Type -> [D.Doc]
559badFlexSuper super tipe =
559badFlexSuper super tipe =
560 case super of
560 case super of
561 T.Comparable ->
561 T.Comparable ->
562− [ H.toSimpleHint "Only ints, floats, chars, strings, lists, and tuples are comparable."
562+ [ D.toSimpleHint "Only ints, floats, chars, strings, lists, and tuples are comparable."
565 T.Appendable ->
565 T.Appendable ->
566 case tipe of
566 case tipe of
567 T.Type home name _ | T.isInt home name ->
567 T.Type home name _ | T.isInt home name ->
568− [ H.toFancyHint ["Try","using",H.green"String.fromInt","to","convert","it","to","a","string?"]
568+ [ D.toFancyHint ["Try","using",D.green"String.fromInt","to","convert","it","to","a","string?"]
571 T.Type home name _ | T.isFloat home name ->
571 T.Type home name _ | T.isFloat home name ->
572− [ H.toFancyHint ["Try","using",H.green"String.fromFloat","to","convert","it","to","a","string?"]
572+ [ D.toFancyHint ["Try","using",D.green"String.fromFloat","to","convert","it","to","a","string?"]
575 T.FlexSuper T.Number _ ->
575 T.FlexSuper T.Number _ ->
576− [ H.toFancyHint ["Try","using",H.green"String.fromInt","to","convert","it","to","a","string?"]
576+ [ D.toFancyHint ["Try","using",D.green"String.fromInt","to","convert","it","to","a","string?"]
580− [ H.toFancyHint ["Only","strings","and","lists","are","appendable.","Put","it","in",H.green "[]","to","make","it","a","list?"]
580+ [ D.toFancyHint ["Only","strings","and","lists","are","appendable.","Put","it","in",D.green "[]","to","make","it","a","list?"]
583 T.CompAppend ->
583 T.CompAppend ->
584− [ H.toSimpleHint "Only strings and lists are both comparable and appendable."
584+ [ D.toSimpleHint "Only strings and lists are both comparable and appendable."
587 T.Number ->
587 T.Number ->
588 case tipe of
588 case tipe of
589 T.Type home name _ | T.isString home name ->
589 T.Type home name _ | T.isString home name ->
590− [ H.toFancyHint ["Try","using",H.green"String.toInt","to","convert","it","to","a","number?"]
590+ [ D.toFancyHint ["Try","using",D.green"String.toInt","to","convert","it","to","a","number?"]
594− [ H.toFancyHint ["Only",H.green "Int","and",H.green "Float","values","work","as","numbers."]
594+ [ D.toFancyHint ["Only",D.green "Int","and",D.green "Float","values","work","as","numbers."]
598−badRigidSuper :: T.Super -> String -> [H.Doc]
598+badRigidSuper :: T.Super -> String -> [D.Doc]
599badRigidSuper super aThing =
599badRigidSuper super aThing =
601 (superType, manyThings) =
601 (superType, manyThings) =
@@ -605,16 +605,16 @@ badRigidSuper super aThing =
605 T.Appendable -> ("appendable", "strings AND lists")
605 T.Appendable -> ("appendable", "strings AND lists")
606 T.CompAppend -> ("compappend", "strings AND lists")
606 T.CompAppend -> ("compappend", "strings AND lists")
608− [ H.toSimpleHint $
608+ [ D.toSimpleHint $
609 "The `" ++ superType ++ "` in your type annotation is saying that "
609 "The `" ++ superType ++ "` in your type annotation is saying that "
610 ++ manyThings ++ " can flow through, but your code is saying it specifically wants "
610 ++ manyThings ++ " can flow through, but your code is saying it specifically wants "
611 ++ aThing ++ ". Maybe change your type annotation to\
611 ++ aThing ++ ". Maybe change your type annotation to\
612 \ be more specific? Maybe change the code to be more general?"
612 \ be more specific? Maybe change the code to be more general?"
613− , H.reflowLink "Read" "type-annotations" "for more advice!"
613+ , D.reflowLink "Read" "type-annotations" "for more advice!"
617−badFlexFlexSuper :: T.Super -> T.Super -> [H.Doc]
617+badFlexFlexSuper :: T.Super -> T.Super -> [D.Doc]
618badFlexFlexSuper s1 s2 =
618badFlexFlexSuper s1 s2 =
620 likeThis super =
620 likeThis super =
@@ -624,7 +624,7 @@ badFlexFlexSuper s1 s2 =
624 T.CompAppend -> "a compappend"
624 T.CompAppend -> "a compappend"
625 T.Appendable -> "appendable"
625 T.Appendable -> "appendable"
627− [ H.toSimpleHint $
627+ [ D.toSimpleHint $
628 "There are no values in Elm that are both"
628 "There are no values in Elm that are both"
629 ++ likeThis s1 ++ " and " ++ likeThis s2 ++ "."
629 ++ likeThis s1 ++ " and " ++ likeThis s2 ++ "."
@@ -656,13 +656,13 @@ toExprReport source localizer exprRegion category tipe expected =
656 FromAnnotation name _arity subContext expectedType ->
656 FromAnnotation name _arity subContext expectedType ->
657 Report.toCodeSnippet source exprRegion Nothing
657 Report.toCodeSnippet source exprRegion Nothing
659− H.reflow $
659+ D.reflow $
660 case subContext of
660 case subContext of
661 TypedIfBranch index ->
661 TypedIfBranch index ->
662− "Something is off with the " <> H.ordinalize (Index.toHuman index) <> " branch of this `if` expression:"
662+ "Something is off with the " <> D.ordinalize (Index.toHuman index) <> " branch of this `if` expression:"
664 TypedCaseBranch index ->
664 TypedCaseBranch index ->
665− "Something is off with the " <> H.ordinalize (Index.toHuman index) <> " branch of this `case` expression:"
665+ "Something is off with the " <> D.ordinalize (Index.toHuman index) <> " branch of this `case` expression:"
667 TypedBody ->
667 TypedBody ->
668 "Something is off with the body of the `" <> N.toString name <> "` definition:"
668 "Something is off with the body of the `" <> N.toString name <> "` definition:"
@@ -672,10 +672,10 @@ toExprReport source localizer exprRegion category tipe expected =
672 toDescription category $
672 toDescription category $
673 case subContext of
673 case subContext of
674 TypedIfBranch index ->
674 TypedIfBranch index ->
675− "The " <> H.ordinalize (Index.toHuman index) <> " branch is"
675+ "The " <> D.ordinalize (Index.toHuman index) <> " branch is"
677 TypedCaseBranch index ->
677 TypedCaseBranch index ->
678− "The " <> H.ordinalize (Index.toHuman index) <> " branch is"
678+ "The " <> D.ordinalize (Index.toHuman index) <> " branch is"
680 TypedBody ->
680 TypedBody ->
681 "The body is"
681 "The body is"
@@ -691,17 +691,17 @@ toExprReport source localizer exprRegion category tipe expected =
691 ListEntry index ->
691 ListEntry index ->
692 Report.toCodeSnippet source region (Just exprRegion)
692 Report.toCodeSnippet source region (Just exprRegion)
694− H.reflow $
694+ D.reflow $
695− "The " <> H.ordinalize (Index.toHuman index) <> " element of this list does not match all the previous elements:"
695+ "The " <> D.ordinalize (Index.toHuman index) <> " element of this list does not match all the previous elements:"
697 typeComparison localizer tipe expectedType
697 typeComparison localizer tipe expectedType
699 toDescription category $
699 toDescription category $
700− "The " <> H.ordinalize (Index.toHuman index) <> " element is"
700+ "The " <> D.ordinalize (Index.toHuman index) <> " element is"
702 "But all the previous elements in the list are:"
702 "But all the previous elements in the list are:"
704− [ H.toSimpleHint $
704+ [ D.toSimpleHint $
705 "Everything in the list needs to be the same type of value.\
705 "Everything in the list needs to be the same type of value.\
706 \ This way you never run into unexpected values partway through.\
706 \ This way you never run into unexpected values partway through.\
707 \ To mix different types in a single list, create a \"union type\" as\
707 \ To mix different types in a single list, create a \"union type\" as\
@@ -717,11 +717,11 @@ toExprReport source localizer exprRegion category tipe expected =
718 loneType localizer tipe expectedType
718 loneType localizer tipe expectedType
720− H.reflow $ toDescription category "It is"
720+ D.reflow $ toDescription category "It is"
722− [ H.fillSep
722+ [ D.fillSep
723 ["But","I","only","now","how","to","negate"
723 ["But","I","only","now","how","to","negate"
724− ,H.dullyellow "Int","and",H.dullyellow "Float","values."
724+ ,D.dullyellow "Int","and",D.dullyellow "Float","values."
@@ -746,9 +746,9 @@ toExprReport source localizer exprRegion category tipe expected =
747 loneType localizer tipe expectedType
747 loneType localizer tipe expectedType
749− H.reflow $ toDescription category "It is"
749+ D.reflow $ toDescription category "It is"
751− [ H.fillSep ["But","I","need","this","`if`","condition","to","be","a",H.dullyellow "Bool","value."]
751+ [ D.fillSep ["But","I","need","this","`if`","condition","to","be","a",D.dullyellow "Bool","value."]
@@ -756,17 +756,17 @@ toExprReport source localizer exprRegion category tipe expected =
756 IfBranch index ->
756 IfBranch index ->
757 Report.toCodeSnippet source region (Just exprRegion)
757 Report.toCodeSnippet source region (Just exprRegion)
759− H.reflow $
759+ D.reflow $
760− "The " <> H.ordinalize (Index.toHuman index) <> " branch of this `if` does not match all the previous branches:"
760+ "The " <> D.ordinalize (Index.toHuman index) <> " branch of this `if` does not match all the previous branches:"
762 typeComparison localizer tipe expectedType
762 typeComparison localizer tipe expectedType
764 toDescription category $
764 toDescription category $
765− "The " <> H.ordinalize (Index.toHuman index) <> " branch is"
765+ "The " <> D.ordinalize (Index.toHuman index) <> " branch is"
767 "But all the previous branches result in:"
767 "But all the previous branches result in:"
769− [ H.link "Hint"
769+ [ D.link "Hint"
770 "All branches in an `if` must produce the same type of values. This way, no\
770 "All branches in an `if` must produce the same type of values. This way, no\
771 \ matter which branch we take, the result is always a consistent shape. Read"
771 \ matter which branch we take, the result is always a consistent shape. Read"
772 "union-types"
772 "union-types"
@@ -778,17 +778,17 @@ toExprReport source localizer exprRegion category tipe expected =
778 CaseBranch index ->
778 CaseBranch index ->
779 Report.toCodeSnippet source region (Just exprRegion)
779 Report.toCodeSnippet source region (Just exprRegion)
781− H.reflow $
781+ D.reflow $
782− "The " <> H.ordinalize (Index.toHuman index) <> " branch of this `case` does not match all the previous branches:"
782+ "The " <> D.ordinalize (Index.toHuman index) <> " branch of this `case` does not match all the previous branches:"
784 typeComparison localizer tipe expectedType
784 typeComparison localizer tipe expectedType
786 toDescription category $
786 toDescription category $
787− "The " <> H.ordinalize (Index.toHuman index) <> " branch is"
787+ "The " <> D.ordinalize (Index.toHuman index) <> " branch is"
789 "But all the previous branches result in:"
789 "But all the previous branches result in:"
791− [ H.link "Hint"
791+ [ D.link "Hint"
792 "All branches in a `case` must produce the same type of values. This way, no\
792 "All branches in a `case` must produce the same type of values. This way, no\
793 \ matter which branch we take, the result is always a consistent shape. Read"
793 \ matter which branch we take, the result is always a consistent shape. Read"
794 "union-types"
794 "union-types"
@@ -801,33 +801,33 @@ toExprReport source localizer exprRegion category tipe expected =
801 case countArgs tipe of
801 case countArgs tipe of
803 Report.toCodeSnippet source region (Just exprRegion)
803 Report.toCodeSnippet source region (Just exprRegion)
804− ( H.reflow $
804+ ( D.reflow $
805 case maybeFuncName of
805 case maybeFuncName of
806 NoName -> "This is not a function:"
806 NoName -> "This is not a function:"
807 FuncName name -> "The `" <> N.toString name <> "` value is not a function:"
807 FuncName name -> "The `" <> N.toString name <> "` value is not a function:"
808 CtorName name -> "The `" <> N.toString name <> "` value is not a function:"
808 CtorName name -> "The `" <> N.toString name <> "` value is not a function:"
809 OpName op -> "The (" <> N.toString op <> ") operator is not a function:"
809 OpName op -> "The (" <> N.toString op <> ") operator is not a function:"
811− H.stack $
811+ D.stack $
812 [ "It has type:"
812 [ "It has type:"
813− , H.indent 4 $ H.dullyellow $ T.toDoc localizer RT.None tipe
813+ , D.indent 4 $ D.dullyellow $ T.toDoc localizer RT.None tipe
814− , H.reflow $ "So it cannot accept arguments, but it got " <> show numArgs <> " anyway."
814+ , D.reflow $ "So it cannot accept arguments, but it got " <> show numArgs <> " anyway."
819 Report.toCodeSnippet source region (Just exprRegion)
819 Report.toCodeSnippet source region (Just exprRegion)
820− ( H.reflow $
820+ ( D.reflow $
821 case maybeFuncName of
821 case maybeFuncName of
822 NoName -> "This function was given too many arguments:"
822 NoName -> "This function was given too many arguments:"
823 FuncName name -> "The `" <> N.toString name <> "` function was given too many arguments:"
823 FuncName name -> "The `" <> N.toString name <> "` function was given too many arguments:"
824 CtorName name -> "The `" <> N.toString name <> "` constructor was given too many arguments:"
824 CtorName name -> "The `" <> N.toString name <> "` constructor was given too many arguments:"
825 OpName op -> "The (" <> N.toString op <> ") operator was given too many arguments:"
825 OpName op -> "The (" <> N.toString op <> ") operator was given too many arguments:"
827− H.stack $
827+ D.stack $
828 [ "It has type:"
828 [ "It has type:"
829− , H.indent 4 $ H.dullyellow $ T.toDoc localizer RT.None tipe
829+ , D.indent 4 $ D.dullyellow $ T.toDoc localizer RT.None tipe
830− , H.reflow $ "So it expects " <> H.args n <> ", but it got " <> show numArgs <> " instead."
830+ , D.reflow $ "So it expects " <> D.args n <> ", but it got " <> show numArgs <> " instead."
@@ -842,20 +842,20 @@ toExprReport source localizer exprRegion category tipe expected =
843 Report.toCodeSnippet source region (Just exprRegion)
843 Report.toCodeSnippet source region (Just exprRegion)
845− H.reflow $
845+ D.reflow $
846− "The " <> H.ordinalize (Index.toHuman index) <> " argument to " <> thisFunction <> " is not what I expect:"
846+ "The " <> D.ordinalize (Index.toHuman index) <> " argument to " <> thisFunction <> " is not what I expect:"
848 typeComparison localizer tipe expectedType
848 typeComparison localizer tipe expectedType
850 toDescription category "This argument is"
850 toDescription category "This argument is"
852− "But " <> thisFunction <> " needs the " <> H.ordinalize (Index.toHuman index)
852+ "But " <> thisFunction <> " needs the " <> D.ordinalize (Index.toHuman index)
853 <> " argument to be:"
853 <> " argument to be:"
855 if Index.toHuman index == 1 then
855 if Index.toHuman index == 1 then
858− [ H.toSimpleHint $
858+ [ D.toSimpleHint $
859 "I always figure out the argument types from left to right. If an argument\
859 "I always figure out the argument types from left to right. If an argument\
860 \ is acceptable, I assume it is “correct” and move on. So the problem may\
860 \ is acceptable, I assume it is “correct” and move on. So the problem may\
861 \ actually be in one of the previous arguments!"
861 \ actually be in one of the previous arguments!"
@@ -868,19 +868,19 @@ toExprReport source localizer exprRegion category tipe expected =
869 Report.toCodeSnippet source region (Just exprRegion)
869 Report.toCodeSnippet source region (Just exprRegion)
871− H.reflow $
871+ D.reflow $
872 case maybeName of
872 case maybeName of
873 NoName ->
873 NoName ->
874− "You are giving " <> H.args numGivenArgs <> " to something that is not a function!"
874+ "You are giving " <> D.args numGivenArgs <> " to something that is not a function!"
876 FuncName name ->
876 FuncName name ->
877− "`" <> N.toString name <> "` is not a function, but you are giving it " <> H.args numGivenArgs <> "!"
877+ "`" <> N.toString name <> "` is not a function, but you are giving it " <> D.args numGivenArgs <> "!"
879 CtorName name ->
879 CtorName name ->
880− "`" <> N.toString name <> "` is not a function, but you are giving it " <> H.args numGivenArgs <> "!"
880+ "`" <> N.toString name <> "` is not a function, but you are giving it " <> D.args numGivenArgs <> "!"
882 OpName op ->
882 OpName op ->
883− "(" <> N.toString op <> ") is not a function, but you are giving it " <> H.args numGivenArgs <> "!"
883+ "(" <> N.toString op <> ") is not a function, but you are giving it " <> D.args numGivenArgs <> "!"
885 typeComparison localizer tipe expectedType
885 typeComparison localizer tipe expectedType
@@ -897,7 +897,7 @@ toExprReport source localizer exprRegion category tipe expected =
897 OpName op ->
897 OpName op ->
898 "(" <> N.toString op <> ") is a value of type:"
898 "(" <> N.toString op <> ") is a value of type:"
900− "But you are giving it " <> H.args numGivenArgs <> " as if its type was:"
900+ "But you are giving it " <> D.args numGivenArgs <> " as if its type was:"
902 [ "Maybe you forgot some parentheses? Or a comma?"
902 [ "Maybe you forgot some parentheses? Or a comma?"
@@ -922,17 +922,17 @@ toExprReport source localizer exprRegion category tipe expected =
923 Report.toCodeSnippet source region (Just exprRegion)
923 Report.toCodeSnippet source region (Just exprRegion)
925− H.reflow $
925+ D.reflow $
926 thisFunction <> " is getting too many arguments:"
926 thisFunction <> " is getting too many arguments:"
928 typeComparison localizer tipe expectedType
928 typeComparison localizer tipe expectedType
930− thisFunction <> " is expecting to get " <> H.args numExpectedArgs <> " like this:"
930+ thisFunction <> " is expecting to get " <> D.args numExpectedArgs <> " like this:"
932− "But you are giving it " <> H.args numGivenArgs <> " as if its type was:"
932+ "But you are giving it " <> D.args numGivenArgs <> " as if its type was:"
934 [ "Maybe you forgot some parentheses? Or a comma?"
934 [ "Maybe you forgot some parentheses? Or a comma?"
935− , H.toSimpleNote $
935+ , D.toSimpleNote $
936 "I am not good at figuring out which arguments are extra myself. The\
936 "I am not good at figuring out which arguments are extra myself. The\
937 \ problem may even be that the FUNCTION is defined funny, and the arguments are\
937 \ problem may even be that the FUNCTION is defined funny, and the arguments are\
938 \ actually fine. Anyway, I hope I gave enough info to help you figure it out!"
938 \ actually fine. Anyway, I hope I gave enough info to help you figure it out!"
@@ -945,15 +945,15 @@ toExprReport source localizer exprRegion category tipe expected =
945 case tipe of
945 case tipe of
946 T.Record _ _ ->
946 T.Record _ _ ->
948− H.reflow $
948+ D.reflow $
949 "This record does not have a `" <> N.toString field <> "` field:"
949 "This record does not have a `" <> N.toString field <> "` field:"
951 loneType localizer tipe expectedType
951 loneType localizer tipe expectedType
953− H.reflow $ "It is a record with this type:"
953+ D.reflow $ "It is a record with this type:"
955− [ H.fillSep
955+ [ D.fillSep
956− ["Is","the",H.dullyellow ("." <> H.nameToDoc field)
956+ ["Is","the",D.dullyellow ("." <> D.fromName field)
957 ,"field","access","is","misspelled?"
957 ,"field","access","is","misspelled?"
@@ -962,14 +962,14 @@ toExprReport source localizer exprRegion category tipe expected =
965− H.reflow $
965+ D.reflow $
966 "This is not a record, so it has no fields to access!"
966 "This is not a record, so it has no fields to access!"
968 loneType localizer tipe expectedType
968 loneType localizer tipe expectedType
969− ( H.reflow $ toDescription category "It is"
969+ ( D.reflow $ toDescription category "It is"
970− , [ H.fillSep
970+ , [ D.fillSep
971 ["But","I","need","a","record","with","a"
971 ["But","I","need","a","record","with","a"
972− ,H.dullyellow (H.nameToDoc field),"field!"
972+ ,D.dullyellow (D.fromName field),"field!"
@@ -980,7 +980,7 @@ toExprReport source localizer exprRegion category tipe expected =
980 T.Record _ _ ->
980 T.Record _ _ ->
981 Report.toCodeSnippet source region Nothing $
981 Report.toCodeSnippet source region Nothing $
983− H.reflow $
983+ D.reflow $
984 "I think there is a typo in one of these field names:"
984 "I think there is a typo in one of these field names:"
986 typeComparison localizer tipe expectedType
986 typeComparison localizer tipe expectedType
@@ -989,7 +989,7 @@ toExprReport source localizer exprRegion category tipe expected =
990 "But you are saying it should have these fields:"
990 "But you are saying it should have these fields:"
992− [ H.reflow "Maybe there is some typo?"
992+ [ D.reflow "Maybe there is some typo?"
@@ -1000,8 +1000,8 @@ toExprReport source localizer exprRegion category tipe expected =
1000 "The record update syntax does not work with this value:"
1000 "The record update syntax does not work with this value:"
1002 loneType localizer tipe expectedType
1002 loneType localizer tipe expectedType
1003− ( H.reflow $ toDescription category "It is"
1003+ ( D.reflow $ toDescription category "It is"
1004− , [ H.reflow $ "But I need some kind of record here!"
1004+ , [ D.reflow $ "But I need some kind of record here!"
@@ -1009,7 +1009,7 @@ toExprReport source localizer exprRegion category tipe expected =
1009 Destructure ->
1009 Destructure ->
1010 Report.toCodeSnippet source region Nothing
1010 Report.toCodeSnippet source region Nothing
1012− H.reflow $
1012+ D.reflow $
1013 "I cannot destructure "
1013 "I cannot destructure "
1015 typeComparison localizer tipe expectedType
1015 typeComparison localizer tipe expectedType
@@ -1041,7 +1041,7 @@ countArgs tipe =
1041-- OP LEFT
1041-- OP LEFT
1044−opLeftToDocs :: T.Localizer -> Category -> N.Name -> T.Type -> T.Type -> (H.Doc, H.Doc)
1044+opLeftToDocs :: T.Localizer -> Category -> N.Name -> T.Type -> T.Type -> (D.Doc, D.Doc)
1045opLeftToDocs localizer category op tipe expected =
1045opLeftToDocs localizer category op tipe expected =
1046 case op of
1046 case op of
@@ -1070,15 +1070,15 @@ opLeftToDocs localizer category op tipe expected =
1070 ( "The left side of (<|) needs to be a function so I can pipe arguments to it!"
1070 ( "The left side of (<|) needs to be a function so I can pipe arguments to it!"
1072 loneType localizer tipe expected
1072 loneType localizer tipe expected
1073− ( H.reflow $ toDescription category "I am seeing"
1073+ ( D.reflow $ toDescription category "I am seeing"
1074− , [ H.reflow $ "This needs to be some kind of function though!"
1074+ , [ D.reflow $ "This needs to be some kind of function though!"
1081− H.reflow $
1081+ D.reflow $
1082 "The left argument of (" <> N.toString op <> ") is causing problems:"
1082 "The left argument of (" <> N.toString op <> ") is causing problems:"
1084 typeComparison localizer tipe expected
1084 typeComparison localizer tipe expected
@@ -1097,8 +1097,8 @@ opLeftToDocs localizer category op tipe expected =
1099data RightDocs
1099data RightDocs
1100− = EmphBoth (H.Doc, H.Doc)
1100+ = EmphBoth (D.Doc, D.Doc)
1101− | EmphRight (H.Doc, H.Doc)
1101+ | EmphRight (D.Doc, D.Doc)
1104opRightToDocs :: T.Localizer -> Category -> N.Name -> T.Type -> T.Type -> RightDocs
1104opRightToDocs :: T.Localizer -> Category -> N.Name -> T.Type -> T.Type -> RightDocs
@@ -1146,7 +1146,7 @@ opRightToDocs localizer category op tipe expected =
1147 EmphRight
1147 EmphRight
1149− H.reflow $
1149+ D.reflow $
1150 "I cannot send this through the (<|) pipe:"
1150 "I cannot send this through the (<|) pipe:"
1152 typeComparison localizer tipe expected
1152 typeComparison localizer tipe expected
@@ -1182,7 +1182,7 @@ opRightToDocs localizer category op tipe expected =
1182 "The right side of (|>) needs to be a function so I can pipe arguments to it!"
1182 "The right side of (|>) needs to be a function so I can pipe arguments to it!"
1184 loneType localizer tipe expected
1184 loneType localizer tipe expected
1185− ( H.reflow $ toDescription category $
1185+ ( D.reflow $ toDescription category $
1186 "But instead of a function, I am seeing "
1186 "But instead of a function, I am seeing "
@@ -1196,7 +1196,7 @@ badOpRightFallback :: T.Localizer -> Category -> N.Name -> T.Type -> T.Type -> R
1196badOpRightFallback localizer category op tipe expected =
1196badOpRightFallback localizer category op tipe expected =
1197 EmphRight
1197 EmphRight
1199− H.reflow $
1199+ D.reflow $
1200 "The right argument of (" <> N.toString op <> ") is causing problems."
1200 "The right argument of (" <> N.toString op <> ") is causing problems."
1202 typeComparison localizer tipe expected
1202 typeComparison localizer tipe expected
@@ -1205,7 +1205,7 @@ badOpRightFallback localizer category op tipe expected =
1206 "But (" <> N.toString op <> ") needs the right argument to be:"
1206 "But (" <> N.toString op <> ") needs the right argument to be:"
1208− [ H.toSimpleHint $
1208+ [ D.toSimpleHint $
1209 "With operators like (" ++ N.toString op ++ ") I always check the left\
1209 "With operators like (" ++ N.toString op ++ ") I always check the left\
1210 \ side first. If it seems fine, I assume it is correct and check the right\
1210 \ side first. If it seems fine, I assume it is correct and check the right\
1211 \ side. So the problem may be in how the left and right arguments interact!"
1211 \ side. So the problem may be in how the left and right arguments interact!"
@@ -1266,7 +1266,7 @@ badConsRight localizer category tipe expected =
1266 T.Type home2 name2 [expectedElement] | T.isList home2 name2 ->
1266 T.Type home2 name2 [expectedElement] | T.isList home2 name2 ->
1267 EmphBoth
1267 EmphBoth
1269− H.reflow "I am having trouble with this (::) operator:"
1269+ D.reflow "I am having trouble with this (::) operator:"
1271 typeComparison localizer expectedElement actualElement
1271 typeComparison localizer expectedElement actualElement
@@ -1276,14 +1276,14 @@ badConsRight localizer category tipe expected =
1277 case expectedElement of
1277 case expectedElement of
1278 T.Type home name [_] | T.isList home name ->
1278 T.Type home name [_] | T.isList home name ->
1279− [ H.toSimpleHint
1279+ [ D.toSimpleHint
1280 "Are you trying to append two lists? The (++) operator\
1280 "Are you trying to append two lists? The (++) operator\
1281 \ appends lists, whereas the (::) operator is only for\
1281 \ appends lists, whereas the (::) operator is only for\
1282 \ adding ONE element to a list."
1282 \ adding ONE element to a list."
1286− [ H.reflow
1286+ [ D.reflow
1287 "Lists need ALL elements to be the same type though."
1287 "Lists need ALL elements to be the same type though."
@@ -1295,13 +1295,13 @@ badConsRight localizer category tipe expected =
1296 EmphRight
1296 EmphRight
1298− H.reflow "The (::) operator can only add elements onto lists."
1298+ D.reflow "The (::) operator can only add elements onto lists."
1300 loneType localizer tipe expected
1300 loneType localizer tipe expected
1302− H.reflow $ toDescription category "The right side is"
1302+ D.reflow $ toDescription category "The right side is"
1304− [H.fillSep ["But","(::)","needs","a",H.dullyellow "List","on","the","right."]
1304+ [D.fillSep ["But","(::)","needs","a",D.dullyellow "List","on","the","right."]
@@ -1312,7 +1312,7 @@ badConsRight localizer category tipe expected =
1314data AppendType
1314data AppendType
1315− = ANumber H.Doc H.Doc
1315+ = ANumber D.Doc D.Doc
1316 | AString
1316 | AString
1318 | AOther
1318 | AOther
@@ -1332,18 +1332,18 @@ toAppendType tipe =
1332 _ -> AOther
1332 _ -> AOther
1335−badAppendLeft :: T.Localizer -> Category -> T.Type -> T.Type -> (H.Doc, H.Doc)
1335+badAppendLeft :: T.Localizer -> Category -> T.Type -> T.Type -> (D.Doc, D.Doc)
1336badAppendLeft localizer category tipe expected =
1336badAppendLeft localizer category tipe expected =
1337 case toAppendType tipe of
1337 case toAppendType tipe of
1338 ANumber thing stringFromThing ->
1338 ANumber thing stringFromThing ->
1340− H.fillSep
1340+ D.fillSep
1341 ["The","(++)","operator","can","append","List","and","String"
1341 ["The","(++)","operator","can","append","List","and","String"
1342− ,"values,","but","not",H.dullyellow thing,"values","like","this:"
1342+ ,"values,","but","not",D.dullyellow thing,"values","like","this:"
1345− H.fillSep
1345+ D.fillSep
1346− ["Try","using",H.green stringFromThing,"to","turn","it","into","a","string?"
1346+ ["Try","using",D.green stringFromThing,"to","turn","it","into","a","string?"
1347 ,"Or","put","it","in","[]","to","make","it","a","list?"
1347 ,"Or","put","it","in","[]","to","make","it","a","list?"
1348 ,"Or","switch","to","the","(::)","operator?"
1348 ,"Or","switch","to","the","(::)","operator?"
@@ -1351,15 +1351,15 @@ badAppendLeft localizer category tipe expected =
1354− H.reflow $
1354+ D.reflow $
1355 "The (++) operator cannot append this type of value:"
1355 "The (++) operator cannot append this type of value:"
1357 loneType localizer tipe expected
1357 loneType localizer tipe expected
1358− ( H.reflow $ toDescription category "I am seeing"
1358+ ( D.reflow $ toDescription category "I am seeing"
1360− [ H.fillSep
1360+ [ D.fillSep
1361 ["But","the","(++)","operator","is","only","for","appending"
1361 ["But","the","(++)","operator","is","only","for","appending"
1362− ,H.dullyellow "List","and",H.dullyellow "String","values."
1362+ ,D.dullyellow "List","and",D.dullyellow "String","values."
1363 ,"Maybe","put","this","value","in","[]","to","make","it","a","list?"
1363 ,"Maybe","put","this","value","in","[]","to","make","it","a","list?"
@@ -1373,13 +1373,13 @@ badAppendRight localizer category tipe expected =
1373 (AString, ANumber thing stringFromThing) ->
1373 (AString, ANumber thing stringFromThing) ->
1374 EmphRight
1374 EmphRight
1376− H.fillSep
1376+ D.fillSep
1377− ["I","thought","I","was","appending",H.dullyellow "String","values","here,"
1377+ ["I","thought","I","was","appending",D.dullyellow "String","values","here,"
1378− ,"not",H.dullyellow thing,"values","like","this:"
1378+ ,"not",D.dullyellow thing,"values","like","this:"
1381− H.fillSep
1381+ D.fillSep
1382− ["Try","using",H.green stringFromThing
1382+ ["Try","using",D.green stringFromThing
1383 ,"to","turn","it","into","a","string?"
1383 ,"to","turn","it","into","a","string?"
@@ -1387,23 +1387,23 @@ badAppendRight localizer category tipe expected =
1387 (AList, ANumber thing _) ->
1387 (AList, ANumber thing _) ->
1388 EmphRight
1388 EmphRight
1390− H.fillSep
1390+ D.fillSep
1391− ["I","thought","I","was","appending",H.dullyellow "List","values","here,"
1391+ ["I","thought","I","was","appending",D.dullyellow "List","values","here,"
1392− ,"not",H.dullyellow thing,"values","like","this:"
1392+ ,"not",D.dullyellow thing,"values","like","this:"
1395− H.reflow "Try putting it in [] to make it a list?"
1395+ D.reflow "Try putting it in [] to make it a list?"
1398 (AString, AList) ->
1398 (AString, AList) ->
1399 EmphBoth
1399 EmphBoth
1401− H.reflow $
1401+ D.reflow $
1402 "The (++) operator needs the same type of value on both sides:"
1402 "The (++) operator needs the same type of value on both sides:"
1404− H.fillSep
1404+ D.fillSep
1405− ["I","see","a",H.dullyellow "String","on","the","left","and","a"
1405+ ["I","see","a",D.dullyellow "String","on","the","left","and","a"
1406− ,H.dullyellow "List","on","the","right.","Which","should","it","be?"
1406+ ,D.dullyellow "List","on","the","right.","Which","should","it","be?"
1407 ,"Does","the","string","need","[]","around","it","to","become","a","list?"
1407 ,"Does","the","string","need","[]","around","it","to","become","a","list?"
@@ -1411,12 +1411,12 @@ badAppendRight localizer category tipe expected =
1411 (AList, AString) ->
1411 (AList, AString) ->
1412 EmphBoth
1412 EmphBoth
1414− H.reflow $
1414+ D.reflow $
1415 "The (++) operator needs the same type of value on both sides:"
1415 "The (++) operator needs the same type of value on both sides:"
1417− H.fillSep
1417+ D.fillSep
1418− ["I","see","a",H.dullyellow "List","on","the","left","and","a"
1418+ ["I","see","a",D.dullyellow "List","on","the","left","and","a"
1419− ,H.dullyellow "String","on","the","right.","Which","should","it","be?"
1419+ ,D.dullyellow "String","on","the","right.","Which","should","it","be?"
1420 ,"Does","the","string","need","[]","around","it","to","become","a","list?"
1420 ,"Does","the","string","need","[]","around","it","to","become","a","list?"
@@ -1424,7 +1424,7 @@ badAppendRight localizer category tipe expected =
1424 (_,_) ->
1424 (_,_) ->
1425 EmphBoth
1425 EmphBoth
1427− H.reflow $
1427+ D.reflow $
1428 "The (++) operator cannot append these two values:"
1428 "The (++) operator cannot append these two values:"
1430 typeComparison localizer expected tipe
1430 typeComparison localizer expected tipe
@@ -1450,14 +1450,14 @@ badCast :: N.Name -> ThisThenThat -> RightDocs
1450badCast op thisThenThat =
1450badCast op thisThenThat =
1451 EmphBoth
1451 EmphBoth
1453− H.text $
1453+ D.reflow $
1454 "I need both sides of (" <> N.toString op <> ") to be the exact same type. Both Int or both Float."
1454 "I need both sides of (" <> N.toString op <> ") to be the exact same type. Both Int or both Float."
1457− anInt = ["an", H.dullyellow "Int"]
1457+ anInt = ["an", D.dullyellow "Int"]
1458− aFloat = ["a", H.dullyellow "Float"]
1458+ aFloat = ["a", D.dullyellow "Float"]
1459− toFloat = H.green "toFloat"
1459+ toFloat = D.green "toFloat"
1460− round = H.green "round"
1460+ round = D.green "round"
1462 case thisThenThat of
1462 case thisThenThat of
1463 FloatInt ->
1463 FloatInt ->
@@ -1468,85 +1468,85 @@ badCast op thisThenThat =
1471−badCastHelp :: [H.Doc] -> [H.Doc] -> H.Doc -> H.Doc -> H.Doc
1471+badCastHelp :: [D.Doc] -> [D.Doc] -> D.Doc -> D.Doc -> D.Doc
1472badCastHelp anInt aFloat toFloat round =
1472badCastHelp anInt aFloat toFloat round =
1473− H.stack
1473+ D.stack
1474− [ H.fillSep $
1474+ [ D.fillSep $
1475 ["But","I","see"]
1475 ["But","I","see"]
1476 ++ anInt
1476 ++ anInt
1477 ++ ["on","the","left","and"]
1477 ++ ["on","the","left","and"]
1478 ++ aFloat
1478 ++ aFloat
1479 ++ ["on","the","right."]
1479 ++ ["on","the","right."]
1480− , H.fillSep
1480+ , D.fillSep
1481 ["Use",toFloat,"on","the","left","(or",round,"on"
1481 ["Use",toFloat,"on","the","left","(or",round,"on"
1482 ,"the","right)","to","make","both","sides","match!"
1482 ,"the","right)","to","make","both","sides","match!"
1484− , H.link "Note" "Read" "implicit-casts" "to learn why Elm does not implicitly convert Ints to Floats."
1484+ , D.link "Note" "Read" "implicit-casts" "to learn why Elm does not implicitly convert Ints to Floats."
1488−badStringAdd :: (H.Doc, H.Doc)
1488+badStringAdd :: (D.Doc, D.Doc)
1489badStringAdd =
1489badStringAdd =
1491− H.fillSep ["I","cannot","do","addition","with",H.dullyellow "String","values","like","this","one:"]
1491+ D.fillSep ["I","cannot","do","addition","with",D.dullyellow "String","values","like","this","one:"]
1493− H.stack
1493+ D.stack
1494− [ H.fillSep
1494+ [ D.fillSep
1495− ["The","(+)","operator","only","works","with",H.dullyellow "Int","and",H.dullyellow "Float","values."
1495+ ["The","(+)","operator","only","works","with",D.dullyellow "Int","and",D.dullyellow "Float","values."
1497− , H.toFancyHint
1497+ , D.toFancyHint
1498− ["Switch","to","the",H.green "(++)","operator","to","append","strings!"
1498+ ["Switch","to","the",D.green "(++)","operator","to","append","strings!"
1504−badListAdd :: T.Localizer -> Category -> String -> T.Type -> T.Type -> (H.Doc, H.Doc)
1504+badListAdd :: T.Localizer -> Category -> String -> T.Type -> T.Type -> (D.Doc, D.Doc)
1505badListAdd localizer category direction tipe expected =
1505badListAdd localizer category direction tipe expected =
1507 "I cannot do addition with lists:"
1507 "I cannot do addition with lists:"
1509 loneType localizer tipe expected
1509 loneType localizer tipe expected
1511− H.reflow $ toDescription category $
1511+ D.reflow $ toDescription category $
1512 "The " <> direction <> " side of (+) is"
1512 "The " <> direction <> " side of (+) is"
1514− [ H.fillSep
1514+ [ D.fillSep
1515− ["But","(+)","only","works","with",H.dullyellow "Int","and",H.dullyellow "Float","values."
1515+ ["But","(+)","only","works","with",D.dullyellow "Int","and",D.dullyellow "Float","values."
1517− , H.toFancyHint
1517+ , D.toFancyHint
1518− ["Switch","to","the",H.green "(++)","operator","to","append","lists!"
1518+ ["Switch","to","the",D.green "(++)","operator","to","append","lists!"
1525−badListMul :: T.Localizer -> Category -> String -> T.Type -> T.Type -> (H.Doc, H.Doc)
1525+badListMul :: T.Localizer -> Category -> String -> T.Type -> T.Type -> (D.Doc, D.Doc)
1526badListMul localizer category direction tipe expected =
1526badListMul localizer category direction tipe expected =
1527 badMath localizer category "Multiplication" direction "*" tipe expected
1527 badMath localizer category "Multiplication" direction "*" tipe expected
1529− H.toFancyHint
1529+ D.toFancyHint
1530 [ "Maybe", "you", "want"
1530 [ "Maybe", "you", "want"
1531− , H.green "List.repeat"
1531+ , D.green "List.repeat"
1532 , "to", "build","a","list","of","repeated","values?"
1532 , "to", "build","a","list","of","repeated","values?"
1537−badMath :: T.Localizer -> Category -> String -> String -> String -> T.Type -> T.Type -> [H.Doc] -> (H.Doc, H.Doc)
1537+badMath :: T.Localizer -> Category -> String -> String -> String -> T.Type -> T.Type -> [D.Doc] -> (D.Doc, D.Doc)
1538badMath localizer category operation direction op tipe expected otherHints =
1538badMath localizer category operation direction op tipe expected otherHints =
1540− H.reflow $
1540+ D.reflow $
1541 operation ++ " does not work with this value:"
1541 operation ++ " does not work with this value:"
1543 loneType localizer tipe expected
1543 loneType localizer tipe expected
1544− ( H.reflow $ toDescription category $
1544+ ( D.reflow $ toDescription category $
1545 "The " <> direction <> " side of (" <> op <> ") is"
1545 "The " <> direction <> " side of (" <> op <> ") is"
1547− [ H.fillSep
1547+ [ D.fillSep
1548− ["But","(" <> H.text op <> ")","only","works","with"
1548+ ["But","(" <> D.fromString op <> ")","only","works","with"
1549− ,H.dullyellow "Int","and",H.dullyellow "Float","values."
1549+ ,D.dullyellow "Int","and",D.dullyellow "Float","values."
1552 ++ otherHints
1552 ++ otherHints
@@ -1554,33 +1554,33 @@ badMath localizer category operation direction op tipe expected otherHints =
1557−badFDiv :: T.Localizer -> H.Doc -> T.Type -> T.Type -> (H.Doc, H.Doc)
1557+badFDiv :: T.Localizer -> D.Doc -> T.Type -> T.Type -> (D.Doc, D.Doc)
1558badFDiv localizer direction tipe expected =
1558badFDiv localizer direction tipe expected =
1560− H.reflow $
1560+ D.reflow $
1561 "The (/) operator is specifically for floating-point division:"
1561 "The (/) operator is specifically for floating-point division:"
1563 if isInt tipe then
1563 if isInt tipe then
1564− H.stack
1564+ D.stack
1565− [ H.fillSep
1565+ [ D.fillSep
1566 ["The",direction,"side","of","(/)","must","be","a"
1566 ["The",direction,"side","of","(/)","must","be","a"
1567− ,H.dullyellow "Float" <> ","
1567+ ,D.dullyellow "Float" <> ","
1568− ,"but","I","am","seeing","an",H.dullyellow "Int" <> "."
1568+ ,"but","I","am","seeing","an",D.dullyellow "Int" <> "."
1569 ,"I","recommend:"
1569 ,"I","recommend:"
1571− , H.vcat
1571+ , D.vcat
1572− [ H.green "toFloat" <> " for explicit conversions " <> H.black "(toFloat 5 / 2) == 2.5"
1572+ [ D.green "toFloat" <> " for explicit conversions " <> D.black "(toFloat 5 / 2) == 2.5"
1573− , H.green "(//) " <> " for integer division " <> H.black "(5 // 2) == 2"
1573+ , D.green "(//) " <> " for integer division " <> D.black "(5 // 2) == 2"
1575− , H.link "Note" "Read" "implicit-casts" "to learn why Elm does not implicitly convert Ints to Floats."
1575+ , D.link "Note" "Read" "implicit-casts" "to learn why Elm does not implicitly convert Ints to Floats."
1579 loneType localizer tipe expected
1579 loneType localizer tipe expected
1581− H.fillSep
1581+ D.fillSep
1582 ["The",direction,"side","of","(/)","must","be","a"
1582 ["The",direction,"side","of","(/)","must","be","a"
1583− ,H.dullyellow "Float" <> ","
1583+ ,D.dullyellow "Float" <> ","
1584 ,"but","instead","I","am","seeing:"
1584 ,"but","instead","I","am","seeing:"
@@ -1588,35 +1588,35 @@ badFDiv localizer direction tipe expected =
1591−badIDiv :: T.Localizer -> H.Doc -> T.Type -> T.Type -> (H.Doc, H.Doc)
1591+badIDiv :: T.Localizer -> D.Doc -> T.Type -> T.Type -> (D.Doc, D.Doc)
1592badIDiv localizer direction tipe expected =
1592badIDiv localizer direction tipe expected =
1594− H.reflow $
1594+ D.reflow $
1595 "The (//) operator is specifically for integer division:"
1595 "The (//) operator is specifically for integer division:"
1597 if isFloat tipe then
1597 if isFloat tipe then
1598− H.stack
1598+ D.stack
1599− [ H.fillSep
1599+ [ D.fillSep
1600 ["The",direction,"side","of","(//)","must","be","an"
1600 ["The",direction,"side","of","(//)","must","be","an"
1601− ,H.dullyellow "Int" <> ","
1601+ ,D.dullyellow "Int" <> ","
1602− ,"but","I","am","seeing","a",H.dullyellow "Float" <> "."
1602+ ,"but","I","am","seeing","a",D.dullyellow "Float" <> "."
1603 ,"I","recommend","doing","the","conversion","explicitly"
1603 ,"I","recommend","doing","the","conversion","explicitly"
1604 ,"with","one","of","these","functions:"
1604 ,"with","one","of","these","functions:"
1606− , H.vcat
1606+ , D.vcat
1607− [ H.green "round" <> " 3.5 == 4"
1607+ [ D.green "round" <> " 3.5 == 4"
1608− , H.green "floor" <> " 3.5 == 3"
1608+ , D.green "floor" <> " 3.5 == 3"
1609− , H.green "ceiling" <> " 3.5 == 4"
1609+ , D.green "ceiling" <> " 3.5 == 4"
1610− , H.green "truncate" <> " 3.5 == 3"
1610+ , D.green "truncate" <> " 3.5 == 3"
1612− , H.link "Note" "Read" "implicit-casts" "to learn why Elm does not implicitly convert Ints to Floats."
1612+ , D.link "Note" "Read" "implicit-casts" "to learn why Elm does not implicitly convert Ints to Floats."
1615 loneType localizer tipe expected
1615 loneType localizer tipe expected
1617− H.fillSep
1617+ D.fillSep
1618 ["The",direction,"side","of","(//)","must","be","an"
1618 ["The",direction,"side","of","(//)","must","be","an"
1619− ,H.dullyellow "Int" <> ","
1619+ ,D.dullyellow "Int" <> ","
1620 ,"but","instead","I","am","seeing:"
1620 ,"but","instead","I","am","seeing:"
@@ -1628,17 +1628,17 @@ badIDiv localizer direction tipe expected =
1628-- BAD BOOLS
1628-- BAD BOOLS
1631−badBool :: T.Localizer -> H.Doc -> H.Doc -> T.Type -> T.Type -> (H.Doc, H.Doc)
1631+badBool :: T.Localizer -> D.Doc -> D.Doc -> T.Type -> T.Type -> (D.Doc, D.Doc)
1632badBool localizer op direction tipe expected =
1632badBool localizer op direction tipe expected =
1634− H.reflow $
1634+ D.reflow $
1635 "I am struggling with this boolean operation:"
1635 "I am struggling with this boolean operation:"
1637 loneType localizer tipe expected
1637 loneType localizer tipe expected
1639− H.fillSep
1639+ D.fillSep
1640 ["Both","sides","of","(" <> op <> ")","must","be"
1640 ["Both","sides","of","(" <> op <> ")","must","be"
1641− ,H.dullyellow "Bool","values,","but","the",direction,"side","is:"
1641+ ,D.dullyellow "Bool","values,","but","the",direction,"side","is:"
@@ -1650,24 +1650,24 @@ badBool localizer op direction tipe expected =
1650-- BAD COMPARISON
1650-- BAD COMPARISON
1653−badCompLeft :: T.Localizer -> Category -> String -> String -> T.Type -> T.Type -> (H.Doc, H.Doc)
1653+badCompLeft :: T.Localizer -> Category -> String -> String -> T.Type -> T.Type -> (D.Doc, D.Doc)
1654badCompLeft localizer category op direction tipe expected =
1654badCompLeft localizer category op direction tipe expected =
1656− H.reflow $
1656+ D.reflow $
1657 "I cannot do a comparison with this value:"
1657 "I cannot do a comparison with this value:"
1659 loneType localizer tipe expected
1659 loneType localizer tipe expected
1661− H.reflow $ toDescription category $
1661+ D.reflow $ toDescription category $
1662 "The " <> direction <> " side of (" <> op <> ") is"
1662 "The " <> direction <> " side of (" <> op <> ") is"
1664− [ H.fillSep
1664+ [ D.fillSep
1665− ["But","(" <> H.text op <> ")","only","works","on"
1665+ ["But","(" <> D.fromString op <> ")","only","works","on"
1666− ,H.dullyellow "Int" <> ","
1666+ ,D.dullyellow "Int" <> ","
1667− ,H.dullyellow "Float" <> ","
1667+ ,D.dullyellow "Float" <> ","
1668− ,H.dullyellow "Char" <> ","
1668+ ,D.dullyellow "Char" <> ","
1670− ,H.dullyellow "String"
1670+ ,D.dullyellow "String"
1671 ,"values.","It","can","work","on","lists","and","tuples"
1671 ,"values.","It","can","work","on","lists","and","tuples"
1672 ,"of","comparable","values","as","well,","but","it","is"
1672 ,"of","comparable","values","as","well,","but","it","is"
1673 ,"usually","better","to","find","a","different","path."
1673 ,"usually","better","to","find","a","different","path."
@@ -1681,7 +1681,7 @@ badCompRight :: T.Localizer -> String -> T.Type -> T.Type -> RightDocs
1681badCompRight localizer op tipe expected =
1681badCompRight localizer op tipe expected =
1682 EmphBoth
1682 EmphBoth
1684− H.reflow $
1684+ D.reflow $
1685 "I need both sides of (" <> op <> ") to be the same type:"
1685 "I need both sides of (" <> op <> ") to be the same type:"
1687 typeComparison localizer expected tipe
1687 typeComparison localizer expected tipe
@@ -1690,7 +1690,7 @@ badCompRight localizer op tipe expected =
1691 "But the right side is:"
1691 "But the right side is:"
1693− [ H.reflow $
1693+ [ D.reflow $
1694 "I cannot compare different types though! Which side of (" <> op <> ") is the problem?"
1694 "I cannot compare different types though! Which side of (" <> op <> ") is the problem?"
@@ -1705,7 +1705,7 @@ badEquality :: T.Localizer -> String -> T.Type -> T.Type -> RightDocs
1705badEquality localizer op tipe expected =
1705badEquality localizer op tipe expected =
1706 EmphBoth
1706 EmphBoth
1708− H.reflow $
1708+ D.reflow $
1709 "I need both sides of (" <> op <> ") to be the same type:"
1709 "I need both sides of (" <> op <> ") to be the same type:"
1711 typeComparison localizer expected tipe
1711 typeComparison localizer expected tipe
@@ -1715,12 +1715,12 @@ badEquality localizer op tipe expected =
1715 "But the right side is:"
1715 "But the right side is:"
1717 if isFloat tipe || isFloat expected then
1717 if isFloat tipe || isFloat expected then
1718− [ H.toSimpleNote $
1718+ [ D.toSimpleNote $
1719 "Equality on floats is not 100% reliable due to the design of IEEE 754. I\
1719 "Equality on floats is not 100% reliable due to the design of IEEE 754. I\
1720 \ recommend a check like (abs (x - y) < 0.0001) instead."
1720 \ recommend a check like (abs (x - y) < 0.0001) instead."
1723− [ H.reflow $
1723+ [ D.reflow $
1724 "Different types can never be equal though! Which side is messed up?"
1724 "Different types can never be equal though! Which side is messed up?"
@@ -1736,15 +1736,15 @@ toInfiniteReport source localizer region name overallType =
1736 Report.Report "INFINITE TYPE" region [] $
1736 Report.Report "INFINITE TYPE" region [] $
1737 Report.toCodeSnippet source region Nothing
1737 Report.toCodeSnippet source region Nothing
1739− H.reflow $
1739+ D.reflow $
1740 "I am inferring a weird self-referential type for " <> N.toString name <> ":"
1740 "I am inferring a weird self-referential type for " <> N.toString name <> ":"
1742− H.stack
1742+ D.stack
1743− [ H.reflow $
1743+ [ D.reflow $
1744 "Here is my best effort at writing down the type. You will see ∞ for\
1744 "Here is my best effort at writing down the type. You will see ∞ for\
1745 \ parts of the type that repeat something already printed out infinitely."
1745 \ parts of the type that repeat something already printed out infinitely."
1746− , H.indent 4 (H.dullyellow (T.toDoc localizer RT.None overallType))
1746+ , D.indent 4 (D.dullyellow (T.toDoc localizer RT.None overallType))
1747− , H.reflowLink
1747+ , D.reflowLink
1748 "Staring at the type is usually not so helpful, so I recommend reading the hints at"
1748 "Staring at the type is usually not so helpful, so I recommend reading the hints at"
1749 "infinite-type"
1749 "infinite-type"
1750 "to get unstuck."
1750 "to get unstuck."