@@ -151,7 +151,7 @@ toReport source err =
151 numDefArgs = numTypeArgs + leftovers
151 numDefArgs = numTypeArgs + leftovers
153 Report.Report "BAD TYPE ANNOTATION" region [] $
153 Report.Report "BAD TYPE ANNOTATION" region [] $
154− Report.toCodeSnippet source region Nothing
154+ Code.toSnippet source region Nothing
156 D.reflow $
156 D.reflow $
157 "The type annotation for `" <> Name.toChars name <> "` says it can accept "
157 "The type annotation for `" <> Name.toChars name <> "` says it can accept "
@@ -185,7 +185,7 @@ toReport source err =
186 if actual < expected then
186 if actual < expected then
187 Report.Report "TOO FEW ARGS" region [] $
187 Report.Report "TOO FEW ARGS" region [] $
188− Report.toCodeSnippet source region Nothing
188+ Code.toSnippet source region Nothing
190 D.reflow $
190 D.reflow $
191 "The `" <> Name.toChars name <> "` " <> thing <> " needs "
191 "The `" <> Name.toChars name <> "` " <> thing <> " needs "
@@ -197,7 +197,7 @@ toReport source err =
199 Report.Report "TOO MANY ARGS" region [] $
199 Report.Report "TOO MANY ARGS" region [] $
200− Report.toCodeSnippet source region Nothing
200+ Code.toSnippet source region Nothing
202 D.reflow $
202 D.reflow $
203 "The `" <> Name.toChars name <> "` " <> thing <> " needs "
203 "The `" <> Name.toChars name <> "` " <> thing <> " needs "
@@ -211,7 +211,7 @@ toReport source err =
212 Binop region op1 op2 ->
212 Binop region op1 op2 ->
213 Report.Report "INFIX PROBLEM" region [] $
213 Report.Report "INFIX PROBLEM" region [] $
214− Report.toCodeSnippet source region Nothing
214+ Code.toSnippet source region Nothing
216 D.reflow $
216 D.reflow $
217 "You cannot mix (" <> Name.toChars op1 <> ") and (" <> Name.toChars op2 <> ") without parentheses."
217 "You cannot mix (" <> Name.toChars op1 <> ") and (" <> Name.toChars op2 <> ") without parentheses."
@@ -268,7 +268,7 @@ toReport source err =
269 EffectNotFound region name ->
269 EffectNotFound region name ->
270 Report.Report "EFFECT PROBLEM" region [] $
270 Report.Report "EFFECT PROBLEM" region [] $
271− Report.toCodeSnippet source region Nothing
271+ Code.toSnippet source region Nothing
273 D.reflow $
273 D.reflow $
274 "You have declared that `" ++ Name.toChars name ++ "` is an effect type:"
274 "You have declared that `" ++ Name.toChars name ++ "` is an effect type:"
@@ -279,7 +279,7 @@ toReport source err =
280 EffectFunctionNotFound region name ->
280 EffectFunctionNotFound region name ->
281 Report.Report "EFFECT PROBLEM" region [] $
281 Report.Report "EFFECT PROBLEM" region [] $
282− Report.toCodeSnippet source region Nothing
282+ Code.toSnippet source region Nothing
284 D.reflow $
284 D.reflow $
285 "This kind of effect module must define a `" ++ Name.toChars name ++ "` function."
285 "This kind of effect module must define a `" ++ Name.toChars name ++ "` function."
@@ -295,7 +295,7 @@ toReport source err =
295 "You are trying to expose `" <> Name.toChars name <> "` multiple times!"
295 "You are trying to expose `" <> Name.toChars name <> "` multiple times!"
297 Report.Report "REDUNDANT EXPORT" r2 [] $
297 Report.Report "REDUNDANT EXPORT" r2 [] $
298− Report.toCodePair source r1 r2
298+ Code.toPair source r1 r2
300 D.reflow messageThatEndsWithPunctuation
300 D.reflow messageThatEndsWithPunctuation
@@ -339,7 +339,7 @@ toReport source err =
340 ExportOpenAlias region name ->
340 ExportOpenAlias region name ->
341 Report.Report "BAD EXPORT" region [] $
341 Report.Report "BAD EXPORT" region [] $
342− Report.toCodeSnippet source region Nothing
342+ Code.toSnippet source region Nothing
344 D.reflow $
344 D.reflow $
345 "The (..) syntax is for exposing union type constructors. It cannot be used with a type alias like `"
345 "The (..) syntax is for exposing union type constructors. It cannot be used with a type alias like `"
@@ -351,7 +351,7 @@ toReport source err =
352 ImportCtorByName region ctor tipe ->
352 ImportCtorByName region ctor tipe ->
353 Report.Report "BAD IMPORT" region [] $
353 Report.Report "BAD IMPORT" region [] $
354− Report.toCodeSnippet source region Nothing
354+ Code.toSnippet source region Nothing
356 D.reflow $
356 D.reflow $
357 "You are trying to import the `" <> Name.toChars ctor
357 "You are trying to import the `" <> Name.toChars ctor
@@ -371,7 +371,7 @@ toReport source err =
371 -- So this error should never actually get printed out.
371 -- So this error should never actually get printed out.
373 Report.Report "UNKNOWN IMPORT" region [] $
373 Report.Report "UNKNOWN IMPORT" region [] $
374− Report.toCodeSnippet source region Nothing
374+ Code.toSnippet source region Nothing
376 D.reflow $
376 D.reflow $
377 "I could not find a `" <> Name.toChars name <> "` module to import!"
377 "I could not find a `" <> Name.toChars name <> "` module to import!"
@@ -381,7 +381,7 @@ toReport source err =
382 ImportOpenAlias region name ->
382 ImportOpenAlias region name ->
383 Report.Report "BAD IMPORT" region [] $
383 Report.Report "BAD IMPORT" region [] $
384− Report.toCodeSnippet source region Nothing
384+ Code.toSnippet source region Nothing
386 D.reflow $
386 D.reflow $
387 "The `" <> Name.toChars name <> "` type alias cannot be followed by (..) like this:"
387 "The `" <> Name.toChars name <> "` type alias cannot be followed by (..) like this:"
@@ -402,7 +402,7 @@ toReport source err =
402 Suggest.sort (Name.toChars home) Name.toChars possibleNames
402 Suggest.sort (Name.toChars home) Name.toChars possibleNames
404 Report.Report "BAD IMPORT" region suggestions $
404 Report.Report "BAD IMPORT" region suggestions $
405− Report.toCodeSnippet source region Nothing
405+ Code.toSnippet source region Nothing
407 D.reflow $
407 D.reflow $
408 "The `" <> Name.toChars home
408 "The `" <> Name.toChars home
@@ -435,7 +435,7 @@ toReport source err =
435 NotFoundBinop region op locals ->
435 NotFoundBinop region op locals ->
436 if op == "===" then
436 if op == "===" then
437 Report.Report "UNKNOWN OPERATOR" region ["=="] $
437 Report.Report "UNKNOWN OPERATOR" region ["=="] $
438− Report.toCodeSnippet source region Nothing
438+ Code.toSnippet source region Nothing
440 "Elm does not have a (===) operator like JavaScript."
440 "Elm does not have a (===) operator like JavaScript."
@@ -444,7 +444,7 @@ toReport source err =
445 else if op == "!=" || op == "!==" then
445 else if op == "!=" || op == "!==" then
446 Report.Report "UNKNOWN OPERATOR" region ["/="] $
446 Report.Report "UNKNOWN OPERATOR" region ["/="] $
447− Report.toCodeSnippet source region Nothing
447+ Code.toSnippet source region Nothing
449 D.reflow $
449 D.reflow $
450 "Elm uses a different name for the “not equal” operator:"
450 "Elm uses a different name for the “not equal” operator:"
@@ -459,7 +459,7 @@ toReport source err =
460 else if op == "**" then
460 else if op == "**" then
461 Report.Report "UNKNOWN OPERATOR" region ["^","*"] $
461 Report.Report "UNKNOWN OPERATOR" region ["^","*"] $
462− Report.toCodeSnippet source region Nothing
462+ Code.toSnippet source region Nothing
464 D.reflow $
464 D.reflow $
465 "I do not recognize the (**) operator:"
465 "I do not recognize the (**) operator:"
@@ -470,7 +470,7 @@ toReport source err =
471 else if op == "%" then
471 else if op == "%" then
472 Report.Report "UNKNOWN OPERATOR" region [] $
472 Report.Report "UNKNOWN OPERATOR" region [] $
473− Report.toCodeSnippet source region Nothing
473+ Code.toSnippet source region Nothing
475 D.reflow $
475 D.reflow $
476 "Elm does not use (%) as the remainder operator:"
476 "Elm does not use (%) as the remainder operator:"
@@ -497,7 +497,7 @@ toReport source err =
497 D.green $ "(" <> altOp <> ")"
497 D.green $ "(" <> altOp <> ")"
499 Report.Report "UNKNOWN OPERATOR" region suggestions $
499 Report.Report "UNKNOWN OPERATOR" region suggestions $
500− Report.toCodeSnippet source region Nothing
500+ Code.toSnippet source region Nothing
502 D.reflow $
502 D.reflow $
503 "I do not recognize the (" ++ Name.toChars op ++ ") operator."
503 "I do not recognize the (" ++ Name.toChars op ++ ") operator."
@@ -515,7 +515,7 @@ toReport source err =
516 PatternHasRecordCtor region name ->
516 PatternHasRecordCtor region name ->
517 Report.Report "BAD PATTERN" region [] $
517 Report.Report "BAD PATTERN" region [] $
518− Report.toCodeSnippet source region Nothing
518+ Code.toSnippet source region Nothing
520 D.reflow $
520 D.reflow $
521 "You can construct records by using `" <> Name.toChars name
521 "You can construct records by using `" <> Name.toChars name
@@ -529,7 +529,7 @@ toReport source err =
530 formatDetails (aBadKindOfThing, elaboration) =
530 formatDetails (aBadKindOfThing, elaboration) =
531 Report.Report "PORT ERROR" region [] $
531 Report.Report "PORT ERROR" region [] $
532− Report.toCodeSnippet source region Nothing
532+ Code.toSnippet source region Nothing
534 D.reflow $
534 D.reflow $
535 "The `" <> Name.toChars portName <> "` port is trying to transmit " <> aBadKindOfThing <> ":"
535 "The `" <> Name.toChars portName <> "` port is trying to transmit " <> aBadKindOfThing <> ":"
@@ -595,7 +595,7 @@ toReport source err =
596 formatDetails (before, after) =
596 formatDetails (before, after) =
597 Report.Report "BAD PORT" region [] $
597 Report.Report "BAD PORT" region [] $
598− Report.toCodeSnippet source region Nothing $
598+ Code.toSnippet source region Nothing $
600 D.reflow before
600 D.reflow before
@@ -674,7 +674,7 @@ toReport source err =
674 D.fillSep $ map (D.dullyellow . D.fromChars) (words question) ++ map D.fromChars (words details)
674 D.fillSep $ map (D.dullyellow . D.fromChars) (words question) ++ map D.fromChars (words details)
676 Report.Report "CYCLIC DEFINITION" region [] $
676 Report.Report "CYCLIC DEFINITION" region [] $
677− Report.toCodeSnippet source region Nothing $
677+ Code.toSnippet source region Nothing $
678 case names of
678 case names of
@@ -716,7 +716,7 @@ toReport source err =
717 RecursiveLet (A.At region name) names ->
717 RecursiveLet (A.At region name) names ->
718 Report.Report "CYCLIC VALUE" region [] $
718 Report.Report "CYCLIC VALUE" region [] $
719− Report.toCodeSnippet source region Nothing $
719+ Code.toSnippet source region Nothing $
720 case names of
720 case names of
@@ -762,7 +762,7 @@ toReport source err =
763 Shadowing name r1 r2 ->
763 Shadowing name r1 r2 ->
764 Report.Report "SHADOWING" r2 [] $
764 Report.Report "SHADOWING" r2 [] $
765− Report.toCodePair source r1 r2
765+ Code.toPair source r1 r2
766 ( "These variables cannot have the same name:"
766 ( "These variables cannot have the same name:"
@@ -783,7 +783,7 @@ toReport source err =
784 TupleLargerThanThree region ->
784 TupleLargerThanThree region ->
785 Report.Report "BAD TUPLE" region [] $
785 Report.Report "BAD TUPLE" region [] $
786− Report.toCodeSnippet source region Nothing
786+ Code.toSnippet source region Nothing
788 "I only accept tuples with two or three items. This has too many:"
788 "I only accept tuples with two or three items. This has too many:"
@@ -832,7 +832,7 @@ toReport source err =
834 Report.Report title aliasRegion [] $
834 Report.Report title aliasRegion [] $
835− Report.toCodeSnippet source aliasRegion subRegion
835+ Code.toSnippet source aliasRegion subRegion
837 D.fillSep overview
837 D.fillSep overview
@@ -885,7 +885,7 @@ toReport source err =
887 Report.Report "TYPE VARIABLE PROBLEMS" aliasRegion [] $
887 Report.Report "TYPE VARIABLE PROBLEMS" aliasRegion [] $
888− Report.toCodeSnippet source aliasRegion Nothing
888+ Code.toSnippet source aliasRegion Nothing
890 D.reflow $
890 D.reflow $
891 "Type alias `" <> Name.toChars typeName <> "` has some type variable problems."
891 "Type alias `" <> Name.toChars typeName <> "` has some type variable problems."
@@ -932,7 +932,7 @@ unboundTypeVars source declRegion tipe typeName allVars (unboundVar, varRegion)
934 Report.Report title declRegion [] $
934 Report.Report title declRegion [] $
935− Report.toCodeSnippet source declRegion subRegion
935+ Code.toSnippet source declRegion subRegion
937 D.fillSep overview
937 D.fillSep overview
@@ -960,7 +960,7 @@ unboundTypeVars source declRegion tipe typeName allVars (unboundVar, varRegion)
960nameClash :: Code.Source -> A.Region -> A.Region -> String -> Report.Report
960nameClash :: Code.Source -> A.Region -> A.Region -> String -> Report.Report
961nameClash source r1 r2 messageThatEndsWithPunctuation =
961nameClash source r1 r2 messageThatEndsWithPunctuation =
962 Report.Report "NAME CLASH" r2 [] $
962 Report.Report "NAME CLASH" r2 [] $
963− Report.toCodePair source r1 r2
963+ Code.toPair source r1 r2
965 D.reflow messageThatEndsWithPunctuation
965 D.reflow messageThatEndsWithPunctuation
@@ -982,7 +982,7 @@ nameClash source r1 r2 messageThatEndsWithPunctuation =
982ambiguousName :: Code.Source -> A.Region -> Maybe Name.Name -> Name.Name -> [ModuleName.Canonical] -> String -> Report.Report
982ambiguousName :: Code.Source -> A.Region -> Maybe Name.Name -> Name.Name -> [ModuleName.Canonical] -> String -> Report.Report
983ambiguousName source region maybePrefix name possibleHomes thing =
983ambiguousName source region maybePrefix name possibleHomes thing =
984 Report.Report "AMBIGUOUS NAME" region [] $
984 Report.Report "AMBIGUOUS NAME" region [] $
985− Report.toCodeSnippet source region Nothing $
985+ Code.toSnippet source region Nothing $
986 case maybePrefix of
986 case maybePrefix of
987 Nothing ->
987 Nothing ->
@@ -1065,7 +1065,7 @@ notFound source region maybePrefix name thing (PossibleNames locals quals) =
1067 Report.Report "NAMING ERROR" region nearbyNames $
1067 Report.Report "NAMING ERROR" region nearbyNames $
1068− Report.toCodeSnippet source region Nothing
1068+ Code.toSnippet source region Nothing
1070 D.reflow $
1070 D.reflow $
1071 "I cannot find a `" ++ givenName ++ "` " ++ thing ++ ":"
1071 "I cannot find a `" ++ givenName ++ "` " ++ thing ++ ":"
@@ -1195,7 +1195,7 @@ _argMismatchReport source region kind name expected actual =
1195 <> " arguments"
1195 <> " arguments"
1197 Report.Report (map Char.toUpper numArgs) region [] $
1197 Report.Report (map Char.toUpper numArgs) region [] $
1198− Report.toCodeSnippet source region Nothing
1198+ Code.toSnippet source region Nothing
1200 D.reflow $
1200 D.reflow $
1201 kind <> " " <> Name.toChars name <> " has " <> numArgs <> "."
1201 kind <> " " <> Name.toChars name <> " has " <> numArgs <> "."
@@ -1214,7 +1214,7 @@ aliasRecursionReport source region name args tipe others =
1214 case others of
1214 case others of
1216 Report.Report "ALIAS PROBLEM" region [] $
1216 Report.Report "ALIAS PROBLEM" region [] $
1217− Report.toCodeSnippet source region Nothing
1217+ Code.toSnippet source region Nothing
1219 "This type alias is recursive, forming an infinite type!"
1219 "This type alias is recursive, forming an infinite type!"
@@ -1233,7 +1233,7 @@ aliasRecursionReport source region name args tipe others =
1235 Report.Report "ALIAS PROBLEM" region [] $
1235 Report.Report "ALIAS PROBLEM" region [] $
1236− Report.toCodeSnippet source region Nothing
1236+ Code.toSnippet source region Nothing
1238 "This type alias is part of a mutually recursive set of type aliases."
1238 "This type alias is part of a mutually recursive set of type aliases."