@@ -43,7 +43,10 @@ import qualified Elm.ModuleName as ModuleName
43import qualified Elm.Package as Pkg
43import qualified Elm.Package as Pkg
44import qualified Elm.Version as V
44import qualified Elm.Version as V
45import qualified Http
45import qualified Http
46+import qualified Json.Decode as Decode
46import qualified Json.Encode as Encode
47import qualified Json.Encode as Encode
48+import qualified Json.String as Json
49+import Parse.Primitives (Row, Col)
47import Reporting.Doc ((<>))
50import Reporting.Doc ((<>))
48import qualified Reporting.Doc as D
51import qualified Reporting.Doc as D
49import qualified Reporting.Error.Import as Import
52import qualified Reporting.Error.Import as Import
@@ -171,16 +174,16 @@ diffToReport diff =
171 Help.report "UNKNOWN PACKAGE" Nothing
174 Help.report "UNKNOWN PACKAGE" Nothing
172 ( "I cannot find a package called:"
175 ( "I cannot find a package called:"
174− [ D.indent 4 $ D.red $ D.fromUtf8 $ Pkg.toString pkg
177+ [ D.indent 4 $ D.red $ D.fromChars $ Pkg.toChars pkg
175 , "Maybe you want one of these instead?"
178 , "Maybe you want one of these instead?"
176− , D.indent 4 $ D.dullyellow $ D.vcat $ map (D.fromUtf8 . Pkg.toString) suggestions
179+ , D.indent 4 $ D.dullyellow $ D.vcat $ map (D.fromChars . Pkg.toChars) suggestions
177 , "But check <https://package.elm-lang.org> to see all possibilities!"
180 , "But check <https://package.elm-lang.org> to see all possibilities!"
180 DiffUnknownVersion _pkg vsn realVersions ->
183 DiffUnknownVersion _pkg vsn realVersions ->
181 Help.docReport "UNKNOWN VERSION" Nothing
184 Help.docReport "UNKNOWN VERSION" Nothing
182 ( D.fillSep $
185 ( D.fillSep $
183− [ "Version", D.red (D.fromUtf8 (V.toString vsn))
186+ [ "Version", D.red (D.fromVersion vsn)
184 , "has", "never", "been", "published,", "so", "I"
187 , "has", "never", "been", "published,", "so", "I"
185 , "cannot", "diff", "against", "it."
188 , "cannot", "diff", "against", "it."
@@ -189,7 +192,7 @@ diffToReport diff =
189 , D.indent 4 $ D.dullyellow $ D.vcat $
192 , D.indent 4 $ D.dullyellow $ D.vcat $
191 sameMajor v1 v2 = V._major v1 == V._major v2
194 sameMajor v1 v2 = V._major v1 == V._major v2
192− mkRow vsns = D.hsep $ map (D.fromUtf8 . V.toString) vsns
195+ mkRow vsns = D.hsep $ map D.fromVersion vsns
194 map mkRow $ List.groupBy sameMajor (List.sort realVersions)
197 map mkRow $ List.groupBy sameMajor (List.sort realVersions)
195 , "Want one of those instead?"
198 , "Want one of those instead?"
@@ -311,19 +314,19 @@ data Solver
313data Outline
316data Outline
314− = OutlineHasBadStructure (Json.Error OutlineProblem)
317+ = OutlineHasBadStructure (Decode.Error OutlineProblem)
315 | OutlineHasBadSrcDirs FilePath [FilePath]
318 | OutlineHasBadSrcDirs FilePath [FilePath]
318data OutlineProblem
321data OutlineProblem
319− = OP_BadType Utf8.String
322+ = OP_BadType
320− | OP_BadPkgName Pkg.BadName
323+ | OP_BadPkgName Row Col
321− | OP_BadVersion Utf8.String
324+ | OP_BadVersion Row Col
322 | OP_BadConstraint C.Error
325 | OP_BadConstraint C.Error
323− | OP_BadModuleName Utf8.String
326+ | OP_BadModuleName Row Col
324− | OP_BadModuleHeaderTooLong Utf8.String
327+ | OP_BadModuleHeaderTooLong
325− | OP_BadDependencyName Utf8.String
328+ | OP_BadDependencyName Row Col
326− | OP_BadLicense Utf8.String [Utf8.String]
329+ | OP_BadLicense Json.String [Json.String]
327 | OP_BadSummaryTooLong
330 | OP_BadSummaryTooLong
328 | OP_NoSrcDirs
331 | OP_NoSrcDirs
@@ -426,7 +429,7 @@ _toReport exit =
426 Help.docReport "CANNOT BUMP" (Just "elm.json")
429 Help.docReport "CANNOT BUMP" (Just "elm.json")
427 ( D.fillSep
430 ( D.fillSep
428 ["Your","elm.json","says","I","should","bump","relative","to","version"
431 ["Your","elm.json","says","I","should","bump","relative","to","version"
429− ,D.red (D.fromUtf8 (V.toString vsn)) <> ","
432+ ,D.red (D.fromVersion vsn) <> ","
430 ,"but","I","cannot","find","that","version","on","<https://package.elm-lang.org>."
433 ,"but","I","cannot","find","that","version","on","<https://package.elm-lang.org>."
431 ,"That","means","there","is","no","API","for","me","to","diff","against","and"
434 ,"That","means","there","is","no","API","for","me","to","diff","against","and"
432 ,"figure","out","if","these","are","MAJOR,","MINOR,","or","PATCH","changes."
435 ,"figure","out","if","these","are","MAJOR,","MINOR,","or","PATCH","changes."
@@ -435,7 +438,7 @@ _toReport exit =
435 [ D.fillSep $
438 [ D.fillSep $
436 ["Try","bumping","again","after","changing","the",D.dullyellow "\"version\"","in","elm.json"]
439 ["Try","bumping","again","after","changing","the",D.dullyellow "\"version\"","in","elm.json"]
437 ++ if length versions == 1 then ["to:"] else ["to","one","of","these:"]
440 ++ if length versions == 1 then ["to:"] else ["to","one","of","these:"]
438− , D.vcat $ map (D.green . D.fromUtf8 . V.toString) versions
441+ , D.vcat $ map (D.green . D.fromVersion) versions
441 BumpMustHaveLatestRegistry problem ->
444 BumpMustHaveLatestRegistry problem ->
@@ -456,7 +459,7 @@ _toReport exit =
456 Help.docReport "INVALID VERSION" Nothing
459 Help.docReport "INVALID VERSION" Nothing
457 ( D.fillSep
460 ( D.fillSep
458 ["I","cannot","publish"
461 ["I","cannot","publish"
459− ,D.red (D.fromUtf8 (V.toString vsn))
462+ ,D.red (D.fromVersion vsn)
460 ,"as","the","initial","version."
463 ,"as","the","initial","version."
@@ -470,7 +473,7 @@ _toReport exit =
470 Help.docReport "ALREADY PUBLISHED" Nothing
473 Help.docReport "ALREADY PUBLISHED" Nothing
472 [ D.fillSep
475 [ D.fillSep
473− [ "Version", D.green (D.fromUtf8 (V.toString vsn))
476+ [ "Version", D.green (D.fromVersion vsn)
474 , "has", "already", "been", "published.", "You", "cannot"
477 , "has", "already", "been", "published.", "You", "cannot"
475 , "publish", "it", "again!"
478 , "publish", "it", "again!"
@@ -487,14 +490,14 @@ _toReport exit =
487 Help.docReport "INVALID VERSION" (Just "elm.json")
490 Help.docReport "INVALID VERSION" (Just "elm.json")
488 ( D.fillSep $
491 ( D.fillSep $
489 ["Your","elm.json","says","the","next","version","should","be"
492 ["Your","elm.json","says","the","next","version","should","be"
490− ,D.red (D.fromUtf8 (V.toString statedVersion)) <> ","
493+ ,D.red (D.fromVersion statedVersion) <> ","
491 ,"but","that","is","not","valid","based","on","the","previously"
494 ,"but","that","is","not","valid","based","on","the","previously"
492 ,"published","versions."
495 ,"published","versions."
495 [ D.fillSep $
498 [ D.fillSep $
496 ["Change","the","version","back","to"
499 ["Change","the","version","back","to"
497− ,D.green (D.fromUtf8 (V.toString latestVersion))
500+ ,D.green (D.fromVersion latestVersion)
498 ,"which","is","the","most","recently","published","version."
501 ,"which","is","the","most","recently","published","version."
499 ,"From","there,","have","Elm","bump","the","version","by","running:"
502 ,"From","there,","have","Elm","bump","the","version","by","running:"
@@ -509,7 +512,7 @@ _toReport exit =
510 D.fillSep $
513 D.fillSep $
511 ["Your","elm.json","says","the","next","version","should","be"
514 ["Your","elm.json","says","the","next","version","should","be"
512− ,D.red (D.fromUtf8 (V.toString new)) <> ","
515+ ,D.red (D.fromVersion new) <> ","
513 ,"indicating","a",D.fromChars (M.toChars magnitude)
516 ,"indicating","a",D.fromChars (M.toChars magnitude)
514 ,"change","to","the","public","API."
517 ,"change","to","the","public","API."
515 ,"This","does","not","match","the","API","diff","given","by:"
518 ,"This","does","not","match","the","API","diff","given","by:"
@@ -522,7 +525,7 @@ _toReport exit =
522 ["This","command","says","this","is","a"
525 ["This","command","says","this","is","a"
523 ,D.fromChars (M.toChars realMagnitude)
526 ,D.fromChars (M.toChars realMagnitude)
524 ,"change,","so","the","next","version","should","be"
527 ,"change,","so","the","next","version","should","be"
525− ,D.green (D.fromUtf8 (V.toString realNew)) <> "."
528+ ,D.green (D.fromVersion realNew) <> "."
526 ,"Double","check","everything","to","make","sure","you"
529 ,"Double","check","everything","to","make","sure","you"
527 ,"are","publishing","what","you","want!"
530 ,"are","publishing","what","you","want!"
@@ -678,10 +681,10 @@ detailsToReport details =
678 DetailsBadElmInPkg constraint ->
681 DetailsBadElmInPkg constraint ->
679 Help.report "ELM VERSION MISMATCH" (Just "elm.json")
682 Help.report "ELM VERSION MISMATCH" (Just "elm.json")
680 "Your elm.json says this package needs a version of Elm in this range:"
683 "Your elm.json says this package needs a version of Elm in this range:"
681− [ D.indent 4 $ D.dullyellow $ D.fromUtf8 $ C.toString constraint
684+ [ D.indent 4 $ D.dullyellow $ D.fromChars $ C.toChars constraint
682 , D.fillSep
685 , D.fillSep
683 [ "But", "you", "are", "using", "Elm"
686 [ "But", "you", "are", "using", "Elm"
684− , D.red (D.fromUtf8 (V.toString V.compiler))
687+ , D.red (D.fromVersion V.compiler)
685 , "right", "now."
688 , "right", "now."
@@ -691,9 +694,9 @@ detailsToReport details =
691 "Your elm.json says this application needs a different version of Elm."
694 "Your elm.json says this application needs a different version of Elm."
692 [ D.fillSep
695 [ D.fillSep
693 [ "It", "requires"
696 [ "It", "requires"
694− , D.green (D.fromUtf8 (V.toString version)) <> ","
697+ , D.green (D.fromVersion version) <> ","
695 , "but", "you", "are", "using"
698 , "but", "you", "are", "using"
696− , D.red (D.fromUtf8 (V.toString V.compiler))
699+ , D.red (D.fromVersion V.compiler)
697 , "right", "now."
700 , "right", "now."
@@ -701,8 +704,8 @@ detailsToReport details =
701 DetailsHandEditedDependencies ->
704 DetailsHandEditedDependencies ->
702 error "TODO DetailsHandEditedDependencies"
705 error "TODO DetailsHandEditedDependencies"
704− DetailsBadOutline problem ->
707+ DetailsBadOutline outlineProblem ->
705− error "TODO DetailsBadOutline" problem
708+ toOutlineReport outlineProblem
707 DetailsCannotGetRegistry problem ->
710 DetailsCannotGetRegistry problem ->
708 error "TODO DetailsCannotGetRegistry" problem
711 error "TODO DetailsCannotGetRegistry" problem
@@ -826,3 +829,52 @@ makeToReport make =
827 MakeCannotLoadArtifacts ->
830 MakeCannotLoadArtifacts ->
828 error "TODO MakeCannotLoadArtifacts"
831 error "TODO MakeCannotLoadArtifacts"
838+toOutlineReport :: Outline -> Help.Report
839+toOutlineReport problem =
841+ OutlineHasBadSrcDirs dir dirs ->
842+ error "TODO OutlineHasBadSrcDirs" dir dirs
844+ OutlineHasBadStructure decodeError ->
845+ error "TODO OutlineHasBadStructure" decodeError toOutlineProblemReport
848+toOutlineProblemReport :: OutlineProblem -> Help.Report
849+toOutlineProblemReport problem =
852+ error "TODO OP_BadType"
854+ OP_BadPkgName row col ->
855+ error "TODO OP_BadPkgName" row col
857+ OP_BadVersion row col ->
858+ error "TODO OP_BadVersion" row col
860+ OP_BadConstraint constraintError ->
861+ error "TODO OP_BadConstraint" constraintError
863+ OP_BadModuleName row col ->
864+ error "TODO OP_BadModuleName" row col
866+ OP_BadModuleHeaderTooLong ->
867+ error "TODO OP_BadModuleHeaderTooLong"
869+ OP_BadDependencyName row col ->
870+ error "TODO OP_BadDependencyName"
872+ OP_BadLicense badLicense suggestions ->
873+ error "TODO OP_BadLicense" badLicense suggestions
875+ OP_BadSummaryTooLong ->
876+ error "TODO OP_BadSummaryTooLong"
879+ error "TODO OP_NoSrcDirs"