@@ -25,7 +25,6 @@ import qualified Elm.ModuleName as ModuleName
25import qualified Reporting.Annotation as A
25import qualified Reporting.Annotation as A
26import qualified Reporting.Doc as D
26import qualified Reporting.Doc as D
27import Reporting.Doc (Doc, (<+>), (<>))
27import Reporting.Doc (Doc, (<+>), (<>))
28−import qualified Reporting.Region as R
29import qualified Reporting.Render.Code as Code
28import qualified Reporting.Render.Code as Code
30import qualified Reporting.Render.Type as RT
29import qualified Reporting.Render.Type as RT
31import qualified Reporting.Report as Report
30import qualified Reporting.Report as Report
@@ -37,44 +36,44 @@ import qualified Reporting.Suggest as Suggest
40− = AnnotationTooShort R.Region Name.Name Index.ZeroBased Int
39+ = AnnotationTooShort A.Region Name.Name Index.ZeroBased Int
41− | AmbiguousVar R.Region (Maybe Name.Name) Name.Name [ModuleName.Canonical]
40+ | AmbiguousVar A.Region (Maybe Name.Name) Name.Name [ModuleName.Canonical]
42− | AmbiguousType R.Region (Maybe Name.Name) Name.Name [ModuleName.Canonical]
41+ | AmbiguousType A.Region (Maybe Name.Name) Name.Name [ModuleName.Canonical]
43− | AmbiguousCtor R.Region (Maybe Name.Name) Name.Name [ModuleName.Canonical]
42+ | AmbiguousVariant A.Region (Maybe Name.Name) Name.Name [ModuleName.Canonical]
44− | AmbiguousBinop R.Region Name.Name [ModuleName.Canonical]
43+ | AmbiguousBinop A.Region Name.Name [ModuleName.Canonical]
45− | BadArity R.Region BadArityContext Name.Name Int Int
44+ | BadArity A.Region BadArityContext Name.Name Int Int
46− | Binop R.Region Name.Name Name.Name
45+ | Binop A.Region Name.Name Name.Name
47− | DuplicateDecl Name.Name R.Region R.Region
46+ | DuplicateDecl Name.Name A.Region A.Region
48− | DuplicateType Name.Name R.Region R.Region
47+ | DuplicateType Name.Name A.Region A.Region
49− | DuplicateCtor Name.Name R.Region R.Region
48+ | DuplicateCtor Name.Name A.Region A.Region
50− | DuplicateBinop Name.Name R.Region R.Region
49+ | DuplicateBinop Name.Name A.Region A.Region
51− | DuplicateField Name.Name R.Region R.Region
50+ | DuplicateField Name.Name A.Region A.Region
52− | DuplicateAliasArg Name.Name Name.Name R.Region R.Region
51+ | DuplicateAliasArg Name.Name Name.Name A.Region A.Region
53− | DuplicateUnionArg Name.Name Name.Name R.Region R.Region
52+ | DuplicateUnionArg Name.Name Name.Name A.Region A.Region
54− | DuplicatePattern DuplicatePatternContext Name.Name R.Region R.Region
53+ | DuplicatePattern DuplicatePatternContext Name.Name A.Region A.Region
55− | EffectNotFound R.Region Name.Name
54+ | EffectNotFound A.Region Name.Name
56− | EffectFunctionNotFound R.Region Name.Name
55+ | EffectFunctionNotFound A.Region Name.Name
57− | ExportDuplicate Name.Name R.Region R.Region
56+ | ExportDuplicate Name.Name A.Region A.Region
58− | ExportNotFound R.Region VarKind Name.Name [Name.Name]
57+ | ExportNotFound A.Region VarKind Name.Name [Name.Name]
59− | ExportOpenAlias R.Region Name.Name
58+ | ExportOpenAlias A.Region Name.Name
60− | ImportCtorByName R.Region Name.Name Name.Name
59+ | ImportCtorByName A.Region Name.Name Name.Name
61− | ImportNotFound R.Region Name.Name [ModuleName.Canonical]
60+ | ImportNotFound A.Region Name.Name [ModuleName.Canonical]
62− | ImportOpenAlias R.Region Name.Name
61+ | ImportOpenAlias A.Region Name.Name
63− | ImportExposingNotFound R.Region ModuleName.Canonical Name.Name [Name.Name]
62+ | ImportExposingNotFound A.Region ModuleName.Canonical Name.Name [Name.Name]
64− | NotFoundVar R.Region (Maybe Name.Name) Name.Name PossibleNames
63+ | NotFoundVar A.Region (Maybe Name.Name) Name.Name PossibleNames
65− | NotFoundType R.Region (Maybe Name.Name) Name.Name PossibleNames
64+ | NotFoundType A.Region (Maybe Name.Name) Name.Name PossibleNames
66− | NotFoundCtor R.Region (Maybe Name.Name) Name.Name PossibleNames
65+ | NotFoundVariant A.Region (Maybe Name.Name) Name.Name PossibleNames
67− | NotFoundBinop R.Region Name.Name (Set.Set Name.Name)
66+ | NotFoundBinop A.Region Name.Name (Set.Set Name.Name)
68− | PatternHasRecordCtor R.Region Name.Name
67+ | PatternHasRecordCtor A.Region Name.Name
69− | PortPayloadInvalid R.Region Name.Name Can.Type InvalidPayload
68+ | PortPayloadInvalid A.Region Name.Name Can.Type InvalidPayload
70− | PortTypeInvalid R.Region Name.Name PortProblem
69+ | PortTypeInvalid A.Region Name.Name PortProblem
71− | RecursiveAlias R.Region Name.Name [Name.Name] Src.Type [Name.Name]
70+ | RecursiveAlias A.Region Name.Name [Name.Name] Src.Type [Name.Name]
72 | RecursiveDecl [Can.Def]
71 | RecursiveDecl [Can.Def]
73 | RecursiveLet (A.Located Name.Name) [Name.Name]
72 | RecursiveLet (A.Located Name.Name) [Name.Name]
74− | Shadowing Name.Name R.Region R.Region
73+ | Shadowing Name.Name A.Region A.Region
75− | TupleLargerThanThree R.Region
74+ | TupleLargerThanThree A.Region
76− | TypeVarsUnboundInUnion R.Region Name.Name [Name.Name] (Name.Name, R.Region) [(Name.Name, R.Region)]
75+ | TypeVarsUnboundInUnion A.Region Name.Name [Name.Name] (Name.Name, A.Region) [(Name.Name, A.Region)]
77− | TypeVarsMessedUpInAlias R.Region Name.Name [Name.Name] [(Name.Name, R.Region)] [(Name.Name, R.Region)]
76+ | TypeVarsMessedUpInAlias A.Region Name.Name [Name.Name] [(Name.Name, A.Region)] [(Name.Name, A.Region)]
80data BadArityContext
79data BadArityContext
@@ -155,7 +154,7 @@ toReport source err =
155 Report.toCodeSnippet source region Nothing
154 Report.toCodeSnippet source region Nothing
157 D.reflow $
156 D.reflow $
158− "The type annotation for `" <> Name.toString name <> "` says it can accept "
157+ "The type annotation for `" <> Name.toChars name <> "` says it can accept "
159 <> D.args numTypeArgs <> ", but the definition says it has "
158 <> D.args numTypeArgs <> ", but the definition says it has "
160 <> D.args numDefArgs <> ":"
159 <> D.args numDefArgs <> ":"
@@ -171,8 +170,8 @@ toReport source err =
171 AmbiguousType region maybePrefix name possibleHomes ->
170 AmbiguousType region maybePrefix name possibleHomes ->
172 ambiguousName source region maybePrefix name possibleHomes "type"
171 ambiguousName source region maybePrefix name possibleHomes "type"
174− AmbiguousCtor region maybePrefix name possibleHomes ->
173+ AmbiguousVariant region maybePrefix name possibleHomes ->
175− ambiguousName source region maybePrefix name possibleHomes "constructor"
174+ ambiguousName source region maybePrefix name possibleHomes "variant"
177 AmbiguousBinop region name possibleHomes ->
176 AmbiguousBinop region name possibleHomes ->
178 ambiguousName source region Nothing name possibleHomes "operator"
177 ambiguousName source region Nothing name possibleHomes "operator"
@@ -182,14 +181,14 @@ toReport source err =
183 case badArityContext of
182 case badArityContext of
184 TypeArity -> "type"
183 TypeArity -> "type"
185− PatternArity -> "constructor"
184+ PatternArity -> "variant"
187 if actual < expected then
186 if actual < expected then
188 Report.Report "TOO FEW ARGS" region [] $
187 Report.Report "TOO FEW ARGS" region [] $
189 Report.toCodeSnippet source region Nothing
188 Report.toCodeSnippet source region Nothing
191 D.reflow $
190 D.reflow $
192− "The `" <> Name.toString name <> "` " <> thing <> " needs "
191+ "The `" <> Name.toChars name <> "` " <> thing <> " needs "
193 <> D.args expected <> ", but I see " <> show actual <> " instead:"
192 <> D.args expected <> ", but I see " <> show actual <> " instead:"
195 D.reflow $
194 D.reflow $
@@ -201,7 +200,7 @@ toReport source err =
201 Report.toCodeSnippet source region Nothing
200 Report.toCodeSnippet source region Nothing
203 D.reflow $
202 D.reflow $
204− "The `" <> Name.toString name <> "` " <> thing <> " needs "
203+ "The `" <> Name.toChars name <> "` " <> thing <> " needs "
205 <> D.args expected <> ", but I see " <> show actual <> " instead:"
204 <> D.args expected <> ", but I see " <> show actual <> " instead:"
207 if actual - expected == 1 then
206 if actual - expected == 1 then
@@ -215,7 +214,7 @@ toReport source err =
215 Report.toCodeSnippet source region Nothing
214 Report.toCodeSnippet source region Nothing
217 D.reflow $
216 D.reflow $
218− "You cannot mix (" <> Name.toString op1 <> ") and (" <> Name.toString op2 <> ") without parentheses."
217+ "You cannot mix (" <> Name.toChars op1 <> ") and (" <> Name.toChars op2 <> ") without parentheses."
221 "I do not know how to group these expressions. Add parentheses for me!"
220 "I do not know how to group these expressions. Add parentheses for me!"
@@ -223,59 +222,59 @@ toReport source err =
224 DuplicateDecl name r1 r2 ->
223 DuplicateDecl name r1 r2 ->
225 nameClash source r1 r2 $
224 nameClash source r1 r2 $
226− "This file has multiple `" <> Name.toString name <> "` declarations."
225+ "This file has multiple `" <> Name.toChars name <> "` declarations."
228 DuplicateType name r1 r2 ->
227 DuplicateType name r1 r2 ->
229 nameClash source r1 r2 $
228 nameClash source r1 r2 $
230− "This file defines multiple `" <> Name.toString name <> "` types."
229+ "This file defines multiple `" <> Name.toChars name <> "` types."
232 DuplicateCtor name r1 r2 ->
231 DuplicateCtor name r1 r2 ->
233 nameClash source r1 r2 $
232 nameClash source r1 r2 $
234− "This file defines multiple `" <> Name.toString name <> "` type constructors."
233+ "This file defines multiple `" <> Name.toChars name <> "` type constructors."
236 DuplicateBinop name r1 r2 ->
235 DuplicateBinop name r1 r2 ->
237 nameClash source r1 r2 $
236 nameClash source r1 r2 $
238− "This file defines multiple (" <> Name.toString name <> ") operators."
237+ "This file defines multiple (" <> Name.toChars name <> ") operators."
240 DuplicateField name r1 r2 ->
239 DuplicateField name r1 r2 ->
241 nameClash source r1 r2 $
240 nameClash source r1 r2 $
242− "This record has multiple `" <> Name.toString name <> "` fields."
241+ "This record has multiple `" <> Name.toChars name <> "` fields."
244 DuplicateAliasArg typeName name r1 r2 ->
243 DuplicateAliasArg typeName name r1 r2 ->
245 nameClash source r1 r2 $
244 nameClash source r1 r2 $
246− "The `" <> Name.toString typeName <> "` type alias has multilpe `" <> Name.toString name <> "` type variables."
245+ "The `" <> Name.toChars typeName <> "` type alias has multilpe `" <> Name.toChars name <> "` type variables."
248 DuplicateUnionArg typeName name r1 r2 ->
247 DuplicateUnionArg typeName name r1 r2 ->
249 nameClash source r1 r2 $
248 nameClash source r1 r2 $
250− "The `" <> Name.toString typeName <> "` type has multilpe `" <> Name.toString name <> "` type variables."
249+ "The `" <> Name.toChars typeName <> "` type has multilpe `" <> Name.toChars name <> "` type variables."
252 DuplicatePattern context name r1 r2 ->
251 DuplicatePattern context name r1 r2 ->
253 nameClash source r1 r2 $
252 nameClash source r1 r2 $
254 case context of
253 case context of
255 DPLambdaArgs ->
254 DPLambdaArgs ->
256− "This anonymous function has multiple `" <> Name.toString name <> "` arguments."
255+ "This anonymous function has multiple `" <> Name.toChars name <> "` arguments."
258 DPFuncArgs funcName ->
257 DPFuncArgs funcName ->
259− "The `" <> Name.toString funcName <> "` function has multiple `" <> Name.toString name <> "` arguments."
258+ "The `" <> Name.toChars funcName <> "` function has multiple `" <> Name.toChars name <> "` arguments."
261 DPCaseBranch ->
260 DPCaseBranch ->
262− "This `case` pattern has multiple `" <> Name.toString name <> "` variables."
261+ "This `case` pattern has multiple `" <> Name.toChars name <> "` variables."
264 DPLetBinding ->
263 DPLetBinding ->
265− "This `let` expression defines `" <> Name.toString name <> "` more than once!"
264+ "This `let` expression defines `" <> Name.toChars name <> "` more than once!"
267 DPDestruct ->
266 DPDestruct ->
268− "This pattern contains multiple `" <> Name.toString name <> "` variables."
267+ "This pattern contains multiple `" <> Name.toChars name <> "` variables."
270 EffectNotFound region name ->
269 EffectNotFound region name ->
271 Report.Report "EFFECT PROBLEM" region [] $
270 Report.Report "EFFECT PROBLEM" region [] $
272 Report.toCodeSnippet source region Nothing
271 Report.toCodeSnippet source region Nothing
274 D.reflow $
273 D.reflow $
275− "You have declared that `" ++ Name.toString name ++ "` is an effect type:"
274+ "You have declared that `" ++ Name.toChars name ++ "` is an effect type:"
277 D.reflow $
276 D.reflow $
278− "But I cannot find a union type named `" ++ Name.toString name ++ "` in this file!"
277+ "But I cannot find a union type named `" ++ Name.toChars name ++ "` in this file!"
281 EffectFunctionNotFound region name ->
280 EffectFunctionNotFound region name ->
@@ -283,17 +282,17 @@ toReport source err =
283 Report.toCodeSnippet source region Nothing
282 Report.toCodeSnippet source region Nothing
285 D.reflow $
284 D.reflow $
286− "This kind of effect module must define a `" ++ Name.toString name ++ "` function."
285+ "This kind of effect module must define a `" ++ Name.toChars name ++ "` function."
288 D.reflow $
287 D.reflow $
289− "But I cannot find `" ++ Name.toString name ++ "` in this file!"
288+ "But I cannot find `" ++ Name.toChars name ++ "` in this file!"
293 ExportDuplicate name r1 r2 ->
292 ExportDuplicate name r1 r2 ->
295 messageThatEndsWithPunctuation =
294 messageThatEndsWithPunctuation =
296− "You are trying to expose `" <> Name.toString name <> "` multiple times!"
295+ "You are trying to expose `" <> Name.toChars name <> "` multiple times!"
298 Report.Report "REDUNDANT EXPORT" r2 [] $
297 Report.Report "REDUNDANT EXPORT" r2 [] $
299 Report.toCodePair source r1 r2
298 Report.toCodePair source r1 r2
@@ -313,8 +312,8 @@ toReport source err =
313 ExportNotFound region kind rawName possibleNames ->
312 ExportNotFound region kind rawName possibleNames ->
315 suggestions =
314 suggestions =
316− map Name.toString $ take 4 $
315+ map Name.toChars $ take 4 $
317− Suggest.sort (Name.toString rawName) Name.toString possibleNames
316+ Suggest.sort (Name.toChars rawName) Name.toChars possibleNames
319 Report.Report "UNKNOWN EXPORT" region suggestions $
318 Report.Report "UNKNOWN EXPORT" region suggestions $
320 let (a, thing, name) = toKindInfo kind rawName in
319 let (a, thing, name) = toKindInfo kind rawName in
@@ -323,7 +322,7 @@ toReport source err =
323 ["You","are","trying","to","expose",a,thing,"named"
322 ["You","are","trying","to","expose",a,thing,"named"
324 ,name,"but","I","cannot","find","its","definition."
323 ,name,"but","I","cannot","find","its","definition."
326− , case map D.fromString suggestions of
325+ , case map D.fromChars suggestions of
328 D.reflow $
327 D.reflow $
329 "I do not see any super similar names in this file. Is the definition missing?"
328 "I do not see any super similar names in this file. Is the definition missing?"
@@ -344,7 +343,7 @@ toReport source err =
345 D.reflow $
344 D.reflow $
346 "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 `"
347− ++ Name.toString name ++ "` though."
346+ ++ Name.toChars name ++ "` though."
349 D.reflow $
348 D.reflow $
350 "Remove the (..) and you should be fine!"
349 "Remove the (..) and you should be fine!"
@@ -355,7 +354,7 @@ toReport source err =
355 Report.toCodeSnippet source region Nothing
354 Report.toCodeSnippet source region Nothing
357 D.reflow $
356 D.reflow $
358− "You are trying to import the `" <> Name.toString ctor
357+ "You are trying to import the `" <> Name.toChars ctor
359 <> "` type constructor by name:"
358 <> "` type constructor by name:"
361 D.fillSep
360 D.fillSep
@@ -375,7 +374,7 @@ toReport source err =
375 Report.toCodeSnippet source region Nothing
374 Report.toCodeSnippet source region Nothing
377 D.reflow $
376 D.reflow $
378− "I could not find a `" <> Name.toString name <> "` module to import!"
377+ "I could not find a `" <> Name.toChars name <> "` module to import!"
@@ -385,7 +384,7 @@ toReport source err =
385 Report.toCodeSnippet source region Nothing
384 Report.toCodeSnippet source region Nothing
387 D.reflow $
386 D.reflow $
388− "The `" <> Name.toString name <> "` type alias cannot be followed by (..) like this:"
387+ "The `" <> Name.toChars name <> "` type alias cannot be followed by (..) like this:"
391 [ "Remove the (..) and it should work."
390 [ "Remove the (..) and it should work."
@@ -399,18 +398,18 @@ toReport source err =
399 ImportExposingNotFound region (ModuleName.Canonical _ home) value possibleNames ->
398 ImportExposingNotFound region (ModuleName.Canonical _ home) value possibleNames ->
401 suggestions =
400 suggestions =
402− map Name.toString $ take 4 $
401+ map Name.toChars $ take 4 $
403− Suggest.sort (Name.toString home) Name.toString possibleNames
402+ Suggest.sort (Name.toChars home) Name.toChars possibleNames
405 Report.Report "BAD IMPORT" region suggestions $
404 Report.Report "BAD IMPORT" region suggestions $
406 Report.toCodeSnippet source region Nothing
405 Report.toCodeSnippet source region Nothing
408 D.reflow $
407 D.reflow $
409− "The `" <> Name.toString home
408+ "The `" <> Name.toChars home
410 <> "` module does not expose `"
409 <> "` module does not expose `"
411− <> Name.toString value <> "`:"
410+ <> Name.toChars value <> "`:"
413− case map D.fromString suggestions of
412+ case map D.fromChars suggestions of
415 "I cannot find any super similar exposed names. Maybe it is private?"
414 "I cannot find any super similar exposed names. Maybe it is private?"
@@ -430,8 +429,8 @@ toReport source err =
430 NotFoundType region prefix name possibleNames ->
429 NotFoundType region prefix name possibleNames ->
431 notFound source region prefix name "type" possibleNames
430 notFound source region prefix name "type" possibleNames
433− NotFoundCtor region prefix name possibleNames ->
432+ NotFoundVariant region prefix name possibleNames ->
434− notFound source region prefix name "constructor" possibleNames
433+ notFound source region prefix name "variant" possibleNames
436 NotFoundBinop region op locals ->
435 NotFoundBinop region op locals ->
437 if op == "===" then
436 if op == "===" then
@@ -454,7 +453,7 @@ toReport source err =
454 [ D.reflow "Switch to (/=) instead."
453 [ D.reflow "Switch to (/=) instead."
455 , D.toSimpleNote $
454 , D.toSimpleNote $
456 "Our (/=) operator is supposed to look like a real “not equal” sign (≠). I hope that history will remember ("
455 "Our (/=) operator is supposed to look like a real “not equal” sign (≠). I hope that history will remember ("
457− ++ Name.toString op ++ ") as a weird and temporary choice."
456+ ++ Name.toChars op ++ ") as a weird and temporary choice."
@@ -491,8 +490,8 @@ toReport source err =
493 suggestions =
492 suggestions =
494− map Name.toString $ take 2 $
493+ map Name.toChars $ take 2 $
495− Suggest.sort (Name.toString op) Name.toString (Set.toList locals)
494+ Suggest.sort (Name.toChars op) Name.toChars (Set.toList locals)
497 format altOp =
496 format altOp =
498 D.green $ "(" <> altOp <> ")"
497 D.green $ "(" <> altOp <> ")"
@@ -501,12 +500,12 @@ toReport source err =
501 Report.toCodeSnippet source region Nothing
500 Report.toCodeSnippet source region Nothing
503 D.reflow $
502 D.reflow $
504− "I do not recognize the (" ++ Name.toString op ++ ") operator."
503+ "I do not recognize the (" ++ Name.toChars op ++ ") operator."
506 D.fillSep $
505 D.fillSep $
507 ["Is","there","an","`import`","and","`exposing`","entry","for","it?"]
506 ["Is","there","an","`import`","and","`exposing`","entry","for","it?"]
509− case map D.fromString suggestions of
508+ case map D.fromChars suggestions of
@@ -519,7 +518,7 @@ toReport source err =
519 Report.toCodeSnippet source region Nothing
518 Report.toCodeSnippet source region Nothing
521 D.reflow $
520 D.reflow $
522− "You can construct records by using `" <> Name.toString name
521+ "You can construct records by using `" <> Name.toChars name
523 <> "` as a function, but it is not available in pattern matching like this:"
522 <> "` as a function, but it is not available in pattern matching like this:"
525 D.reflow $
524 D.reflow $
@@ -533,7 +532,7 @@ toReport source err =
533 Report.toCodeSnippet source region Nothing
532 Report.toCodeSnippet source region Nothing
535 D.reflow $
534 D.reflow $
536− "The `" <> Name.toString portName <> "` port is trying to transmit " <> aBadKindOfThing <> ":"
535+ "The `" <> Name.toChars portName <> "` port is trying to transmit " <> aBadKindOfThing <> ":"
539 [ elaboration
538 [ elaboration
@@ -570,14 +569,14 @@ toReport source err =
570 "an unspecified type"
569 "an unspecified type"
572 D.reflow $
571 D.reflow $
573− "But type variables like `" <> Name.toString name <> "` cannot flow through ports.\
572+ "But type variables like `" <> Name.toChars name <> "` cannot flow through ports.\
574 \ I need to know exactly what type of data I am getting, so I can guarantee that\
573 \ I need to know exactly what type of data I am getting, so I can guarantee that\
575 \ unexpected data cannot sneak in and crash the Elm program."
574 \ unexpected data cannot sneak in and crash the Elm program."
578 UnsupportedType name ->
577 UnsupportedType name ->
580− "a `" <> Name.toString name <> "` value"
579+ "a `" <> Name.toChars name <> "` value"
583 [ D.reflow $ "I cannot handle that. The types that CAN flow in and out of Elm include:"
582 [ D.reflow $ "I cannot handle that. The types that CAN flow in and out of Elm include:"
@@ -611,7 +610,7 @@ toReport source err =
611 case portProblem of
610 case portProblem of
612 CmdNoArg ->
611 CmdNoArg ->
614− "The `" <> Name.toString name <> "` port cannot be just a command."
613+ "The `" <> Name.toChars name <> "` port cannot be just a command."
616 D.reflow $
615 D.reflow $
617 "It can be (() -> Cmd msg) if you just need to trigger a JavaScript\
616 "It can be (() -> Cmd msg) if you just need to trigger a JavaScript\
@@ -620,7 +619,7 @@ toReport source err =
621 CmdExtraArgs n ->
620 CmdExtraArgs n ->
623− "The `" <> Name.toString name <> "` port can only send ONE value out to JavaScript."
622+ "The `" <> Name.toChars name <> "` port can only send ONE value out to JavaScript."
626 theseItemsInSomething
625 theseItemsInSomething
@@ -634,7 +633,7 @@ toReport source err =
635 CmdBadMsg ->
634 CmdBadMsg ->
637− "The `" <> Name.toString name <> "` port cannot send any messages to the `update` function."
636+ "The `" <> Name.toChars name <> "` port cannot send any messages to the `update` function."
639 D.reflow $
638 D.reflow $
640 "It must produce a (Cmd msg) type. Notice the lower case `msg` type\
639 "It must produce a (Cmd msg) type. Notice the lower case `msg` type\
@@ -643,13 +642,13 @@ toReport source err =
645 SubBad ->
644 SubBad ->
646− ( "There is something off about this `" <> Name.toString name <> "` port declaration."
645+ ( "There is something off about this `" <> Name.toChars name <> "` port declaration."
649 [ D.reflow $
648 [ D.reflow $
650 "To receive messages from JavaScript, you need to define a port like this:"
649 "To receive messages from JavaScript, you need to define a port like this:"
651− , D.indent 4 $ D.dullyellow $ D.fromString $
650+ , D.indent 4 $ D.dullyellow $ D.fromChars $
652− "port " <> Name.toString name <> " : (Int -> msg) -> Sub msg"
651+ "port " <> Name.toChars name <> " : (Int -> msg) -> Sub msg"
653 , D.reflow $
652 , D.reflow $
654 "Now every time JS sends an `Int` to this port, it is converted to a `msg`.\
653 "Now every time JS sends an `Int` to this port, it is converted to a `msg`.\
655 \ And if you subscribe, those `msg` values will be piped into your `update`\
654 \ And if you subscribe, those `msg` values will be piped into your `update`\
@@ -659,7 +658,7 @@ toReport source err =
660 NotCmdOrSub ->
659 NotCmdOrSub ->
662− "I am confused about the `" <> Name.toString name <> "` port declaration."
661+ "I am confused about the `" <> Name.toChars name <> "` port declaration."
664 D.reflow $
663 D.reflow $
665 "Ports need to produce a command (Cmd) or a subscription (Sub) but\
664 "Ports need to produce a command (Cmd) or a subscription (Sub) but\
@@ -677,7 +676,7 @@ toReport source err =
677 Can.TypedDef name _ _ _ _ -> name
676 Can.TypedDef name _ _ _ _ -> name
679 makeTheory question details =
678 makeTheory question details =
680− D.fillSep $ map (D.dullyellow . D.fromString) (words question) ++ map D.fromString (words details)
679+ D.fillSep $ map (D.dullyellow . D.fromChars) (words question) ++ map D.fromChars (words details)
682 case map toName cyclicValueDefs of
681 case map toName cyclicValueDefs of
@@ -693,16 +692,16 @@ toReport source err =
695 D.reflow $
694 D.reflow $
696− "The `" <> Name.toString name <> "` value is defined directly in terms of itself, causing an infinite loop."
695+ "The `" <> Name.toChars name <> "` value is defined directly in terms of itself, causing an infinite loop."
699 [ makeTheory "Are you are trying to mutate a variable?" $
698 [ makeTheory "Are you are trying to mutate a variable?" $
700− "Elm does not have mutation, so when I see " ++ Name.toString name
699+ "Elm does not have mutation, so when I see " ++ Name.toChars name
701− ++ " defined in terms of " ++ Name.toString name
700+ ++ " defined in terms of " ++ Name.toChars name
702 ++ ", I treat it as a recursive definition. Try giving the new value a new name!"
701 ++ ", I treat it as a recursive definition. Try giving the new value a new name!"
703 , makeTheory "Maybe you DO want a recursive value?" $
702 , makeTheory "Maybe you DO want a recursive value?" $
704− "To define " ++ Name.toString name ++ " we need to know what " ++ Name.toString name
703+ "To define " ++ Name.toChars name ++ " we need to know what " ++ Name.toChars name
705− ++ " is, so let’s expand it. Wait, but now we need to know what " ++ Name.toString name
704+ ++ " is, so let’s expand it. Wait, but now we need to know what " ++ Name.toChars name
706 ++ " is, so let’s expand it... This will keep going infinitely!"
705 ++ " is, so let’s expand it... This will keep going infinitely!"
707 , D.link "Hint"
706 , D.link "Hint"
708 "The root problem is often a typo in some variable name, but I recommend reading"
707 "The root problem is often a typo in some variable name, but I recommend reading"
@@ -714,11 +713,11 @@ toReport source err =
716 D.reflow $
715 D.reflow $
717− "The `" <> Name.toString name <> "` definition is causing a very tricky infinite loop."
716+ "The `" <> Name.toChars name <> "` definition is causing a very tricky infinite loop."
720 [ D.reflow $
719 [ D.reflow $
721− "The `" <> Name.toString name
720+ "The `" <> Name.toChars name
722 <> "` value depends on itself through the following chain of definitions:"
721 <> "` value depends on itself through the following chain of definitions:"
723 , D.cycle 4 (name:names)
722 , D.cycle 4 (name:names)
724 , D.link "Hint"
723 , D.link "Hint"
@@ -735,20 +734,20 @@ toReport source err =
737 makeTheory question details =
736 makeTheory question details =
738− D.fillSep $ map (D.dullyellow . D.fromString) (words question) ++ map D.fromString (words details)
737+ D.fillSep $ map (D.dullyellow . D.fromChars) (words question) ++ map D.fromChars (words details)
741 D.reflow $
740 D.reflow $
742− "The `" <> Name.toString name <> "` value is defined directly in terms of itself, causing an infinite loop."
741+ "The `" <> Name.toChars name <> "` value is defined directly in terms of itself, causing an infinite loop."
745 [ makeTheory "Are you are trying to mutate a variable?" $
744 [ makeTheory "Are you are trying to mutate a variable?" $
746− "Elm does not have mutation, so when I see " ++ Name.toString name
745+ "Elm does not have mutation, so when I see " ++ Name.toChars name
747− ++ " defined in terms of " ++ Name.toString name
746+ ++ " defined in terms of " ++ Name.toChars name
748 ++ ", I treat it as a recursive definition. Try giving the new value a new name!"
747 ++ ", I treat it as a recursive definition. Try giving the new value a new name!"
749 , makeTheory "Maybe you DO want a recursive value?" $
748 , makeTheory "Maybe you DO want a recursive value?" $
750− "To define " ++ Name.toString name ++ " we need to know what " ++ Name.toString name
749+ "To define " ++ Name.toChars name ++ " we need to know what " ++ Name.toChars name
751− ++ " is, so let’s expand it. Wait, but now we need to know what " ++ Name.toString name
750+ ++ " is, so let’s expand it. Wait, but now we need to know what " ++ Name.toChars name
752 ++ " is, so let’s expand it... This will keep going infinitely!"
751 ++ " is, so let’s expand it... This will keep going infinitely!"
753 , D.link "Hint"
752 , D.link "Hint"
754 "The root problem is often a typo in some variable name, but I recommend reading"
753 "The root problem is often a typo in some variable name, but I recommend reading"
@@ -764,7 +763,7 @@ toReport source err =
766 [ D.reflow $
765 [ D.reflow $
767− "The `" <> Name.toString name
766+ "The `" <> Name.toChars name
768 <> "` value depends on itself through the following chain of definitions:"
767 <> "` value depends on itself through the following chain of definitions:"
769 , D.cycle 4 (name:names)
768 , D.cycle 4 (name:names)
770 , D.link "Hint"
769 , D.link "Hint"
@@ -780,7 +779,7 @@ toReport source err =
780 ( "These variables cannot have the same name:"
779 ( "These variables cannot have the same name:"
783− ( D.reflow $ "The name `" <> Name.toString name <> "` is first defined here:"
782+ ( D.reflow $ "The name `" <> Name.toChars name <> "` is first defined here:"
784 , "But then it is defined AGAIN over here:"
783 , "But then it is defined AGAIN over here:"
@@ -902,7 +901,7 @@ toReport source err =
902 Report.toCodeSnippet source aliasRegion Nothing
901 Report.toCodeSnippet source aliasRegion Nothing
904 D.reflow $
903 D.reflow $
905− "Type alias `" <> Name.toString typeName <> "` has some type variable problems."
904+ "Type alias `" <> Name.toChars typeName <> "` has some type variable problems."
908 [ D.fillSep $ theseAreUsed ++ butTheseAreUnused
907 [ D.fillSep $ theseAreUsed ++ butTheseAreUnused
@@ -921,7 +920,7 @@ toReport source err =
921-- BAD TYPE VARIABLES
920-- BAD TYPE VARIABLES
924−unboundTypeVars :: Code.Source -> R.Region -> [D.Doc] -> Name.Name -> [Name.Name] -> (Name.Name, R.Region) -> [(Name.Name, R.Region)] -> Report.Report
923+unboundTypeVars :: Code.Source -> A.Region -> [D.Doc] -> Name.Name -> [Name.Name] -> (Name.Name, A.Region) -> [(Name.Name, A.Region)] -> Report.Report
925unboundTypeVars source declRegion tipe typeName allVars (unboundVar, varRegion) unboundVars =
924unboundTypeVars source declRegion tipe typeName allVars (unboundVar, varRegion) unboundVars =
927 backQuote name =
926 backQuote name =
@@ -960,7 +959,7 @@ unboundTypeVars source declRegion tipe typeName allVars (unboundVar, varRegion)
960 ++ map (D.green . D.fromName) (unboundVar : map fst unboundVars)
959 ++ map (D.green . D.fromName) (unboundVar : map fst unboundVars)
961 ++ ["=", "..."]
960 ++ ["=", "..."]
962 , D.reflow $
961 , D.reflow $
963− "Why? Well, imagine one `" ++ Name.toString typeName ++ "` where `" ++ Name.toString unboundVar ++
962+ "Why? Well, imagine one `" ++ Name.toChars typeName ++ "` where `" ++ Name.toChars unboundVar ++
964 "` is an Int and another where it is a Bool. When we explicitly list the type\
963 "` is an Int and another where it is a Bool. When we explicitly list the type\
965 \ variables, the type checker can see that they are actually different types."
964 \ variables, the type checker can see that they are actually different types."
@@ -971,7 +970,7 @@ unboundTypeVars source declRegion tipe typeName allVars (unboundVar, varRegion)
971-- NAME CLASH
970-- NAME CLASH
974−nameClash :: Code.Source -> R.Region -> R.Region -> String -> Report.Report
973+nameClash :: Code.Source -> A.Region -> A.Region -> String -> Report.Report
975nameClash source r1 r2 messageThatEndsWithPunctuation =
974nameClash source r1 r2 messageThatEndsWithPunctuation =
976 Report.Report "NAME CLASH" r2 [] $
975 Report.Report "NAME CLASH" r2 [] $
977 Report.toCodePair source r1 r2
976 Report.toCodePair source r1 r2
@@ -993,7 +992,7 @@ nameClash source r1 r2 messageThatEndsWithPunctuation =
993-- AMBIGUOUS NAME
992-- AMBIGUOUS NAME
996−ambiguousName :: Code.Source -> R.Region -> Maybe Name.Name -> Name.Name -> [ModuleName.Canonical] -> String -> Report.Report
995+ambiguousName :: Code.Source -> A.Region -> Maybe Name.Name -> Name.Name -> [ModuleName.Canonical] -> String -> Report.Report
997ambiguousName source region maybePrefix name possibleHomes thing =
996ambiguousName source region maybePrefix name possibleHomes thing =
998 Report.Report "AMBIGUOUS NAME" region [] $
997 Report.Report "AMBIGUOUS NAME" region [] $
999 Report.toCodeSnippet source region Nothing $
998 Report.toCodeSnippet source region Nothing $
@@ -1007,12 +1006,12 @@ ambiguousName source region maybePrefix name possibleHomes thing =
1007 if length possibleHomes == 2 then "both" else "all"
1006 if length possibleHomes == 2 then "both" else "all"
1010− D.reflow $ "This usage of `" ++ Name.toString name ++ "` is ambiguous."
1009+ D.reflow $ "This usage of `" ++ Name.toChars name ++ "` is ambiguous."
1013 [ D.reflow $
1012 [ D.reflow $
1014 "Check your imports. The following modules " ++ bothOrAll
1013 "Check your imports. The following modules " ++ bothOrAll
1015− ++ " expose a `" ++ Name.toString name ++ "` " ++ thing ++ ":"
1014+ ++ " expose a `" ++ Name.toChars name ++ "` " ++ thing ++ ":"
1016 , D.indent 4 $ D.vcat $ map homeToYellowDoc possibleHomes
1015 , D.indent 4 $ D.vcat $ map homeToYellowDoc possibleHomes
1017 , D.reflowLink "Read" "imports" "to learn how to clarify which one you want."
1016 , D.reflowLink "Read" "imports" "to learn how to clarify which one you want."
@@ -1046,18 +1045,18 @@ ambiguousName source region maybePrefix name possibleHomes thing =
1046-- NOT FOUND
1045-- NOT FOUND
1049−notFound :: Code.Source -> R.Region -> Maybe Name.Name -> Name.Name -> String -> PossibleNames -> Report.Report
1048+notFound :: Code.Source -> A.Region -> Maybe Name.Name -> Name.Name -> String -> PossibleNames -> Report.Report
1050notFound source region maybePrefix name thing (PossibleNames locals quals) =
1049notFound source region maybePrefix name thing (PossibleNames locals quals) =
1052 givenName =
1051 givenName =
1053− maybe Name.toString toQualString maybePrefix name
1052+ maybe Name.toChars toQualString maybePrefix name
1055 possibleNames =
1054 possibleNames =
1057 addQuals prefix localSet allNames =
1056 addQuals prefix localSet allNames =
1058 Set.foldr (\x xs -> toQualString prefix x : xs) allNames localSet
1057 Set.foldr (\x xs -> toQualString prefix x : xs) allNames localSet
1060− Map.foldrWithKey addQuals (map Name.toString (Set.toList locals)) quals
1059+ Map.foldrWithKey addQuals (map Name.toChars (Set.toList locals)) quals
1062 nearbyNames =
1061 nearbyNames =
1063 take 4 (Suggest.sort givenName id possibleNames)
1062 take 4 (Suggest.sort givenName id possibleNames)
@@ -1073,7 +1072,7 @@ notFound source region maybePrefix name thing (PossibleNames locals quals) =
1073 suggestions ->
1072 suggestions ->
1075 [ D.reflow yesSuggestionDetails
1074 [ D.reflow yesSuggestionDetails
1076− , D.indent 4 $ D.vcat $ map D.dullyellow $ map D.fromString suggestions
1075+ , D.indent 4 $ D.vcat $ map D.dullyellow $ map D.fromChars suggestions
1077 , D.link "Hint" "Read" "imports" "to see how `import` declarations work in Elm."
1076 , D.link "Hint" "Read" "imports" "to see how `import` declarations work in Elm."
@@ -1094,19 +1093,19 @@ notFound source region maybePrefix name thing (PossibleNames locals quals) =
1094 case Map.lookup prefix quals of
1093 case Map.lookup prefix quals of
1095 Nothing ->
1094 Nothing ->
1096 toDetails
1095 toDetails
1097− ("I cannot find a `" ++ Name.toString prefix ++ "` module. Is there an `import` for it?")
1096+ ("I cannot find a `" ++ Name.toChars prefix ++ "` module. Is there an `import` for it?")
1098− ("I cannot find a `" ++ Name.toString prefix ++ "` import. These names seem close though:")
1097+ ("I cannot find a `" ++ Name.toChars prefix ++ "` import. These names seem close though:")
1100 Just _ ->
1099 Just _ ->
1101 toDetails
1100 toDetails
1102− ("The `" ++ Name.toString prefix ++ "` module does not expose a `" ++ Name.toString name ++ "` " ++ thing ++ ".")
1101+ ("The `" ++ Name.toChars prefix ++ "` module does not expose a `" ++ Name.toChars name ++ "` " ++ thing ++ ".")
1103− ("The `" ++ Name.toString prefix ++ "` module does not expose a `" ++ Name.toString name ++ "` " ++ thing ++ ". These names seem close though:")
1102+ ("The `" ++ Name.toChars prefix ++ "` module does not expose a `" ++ Name.toChars name ++ "` " ++ thing ++ ". These names seem close though:")
1107toQualString :: Name.Name -> Name.Name -> String
1106toQualString :: Name.Name -> Name.Name -> String
1108toQualString prefix name =
1107toQualString prefix name =
1109− Name.toString prefix ++ "." ++ Name.toString name
1108+ Name.toChars prefix ++ "." ++ Name.toChars name
@@ -1200,7 +1199,7 @@ modHint =
1200-- ARG MISMATCH
1199-- ARG MISMATCH
1203−_argMismatchReport :: Code.Source -> R.Region -> String -> Name.Name -> Int -> Int -> Report.Report
1202+_argMismatchReport :: Code.Source -> A.Region -> String -> Name.Name -> Int -> Int -> Report.Report
1204_argMismatchReport source region kind name expected actual =
1203_argMismatchReport source region kind name expected actual =
1206 numArgs =
1205 numArgs =
@@ -1212,7 +1211,7 @@ _argMismatchReport source region kind name expected actual =
1212 Report.toCodeSnippet source region Nothing
1211 Report.toCodeSnippet source region Nothing
1214 D.reflow $
1213 D.reflow $
1215− kind <> " " <> Name.toString name <> " has " <> numArgs <> "."
1214+ kind <> " " <> Name.toChars name <> " has " <> numArgs <> "."
1217 D.reflow $
1216 D.reflow $
1218 "Expecting " <> show expected <> ", but got " <> show actual <> "."
1217 "Expecting " <> show expected <> ", but got " <> show actual <> "."
@@ -1223,7 +1222,7 @@ _argMismatchReport source region kind name expected actual =
1223-- BAD ALIAS RECURSION
1222-- BAD ALIAS RECURSION
1226−aliasRecursionReport :: Code.Source -> R.Region -> Name.Name -> [Name.Name] -> Src.Type -> [Name.Name] -> Report.Report
1225+aliasRecursionReport :: Code.Source -> A.Region -> Name.Name -> [Name.Name] -> Src.Type -> [Name.Name] -> Report.Report
1227aliasRecursionReport source region name args tipe others =
1226aliasRecursionReport source region name args tipe others =
1228 case others of
1227 case others of