@@ -1,6 +1,28 @@
1{-# LANGUAGE OverloadedStrings #-}
1{-# LANGUAGE OverloadedStrings #-}
2module Reporting.Exit
2module Reporting.Exit
16+ , OutlineStructureProblem(..)
17+ , RegistryProblem(..)
22+ , BuildProjectProblem(..)
4 , toString
26 , toString
5 , toStderr
27 , toStderr
@@ -8,21 +30,21 @@ module Reporting.Exit
33+import qualified Data.List as List
34+import qualified Data.Utf8 as Utf8
36+import qualified Elm.Constraint as C
37+import qualified Elm.Magnitude as M
11import qualified Elm.ModuleName as ModuleName
38import qualified Elm.ModuleName as ModuleName
39+import qualified Elm.Package as Pkg
40+import qualified Elm.Version as V
12import qualified Json.Encode as Encode
42import qualified Json.Encode as Encode
43+import Reporting.Doc ((<>))
13import qualified Reporting.Doc as D
44import qualified Reporting.Doc as D
14−import qualified Reporting.Exit.Assets as Asset
45+import qualified Reporting.Error.Json as Json
15−import qualified Reporting.Exit.Bump as Bump
16−import qualified Reporting.Exit.Compile as Compile
17−import qualified Reporting.Exit.Crawl as Crawl
18−import qualified Reporting.Exit.Deps as Deps
19−import qualified Reporting.Exit.Diff as Diff
20import qualified Reporting.Exit.Help as Help
46import qualified Reporting.Exit.Help as Help
21−import qualified Reporting.Exit.Http as Http
47+import qualified Reporting.Problem as Problem
22−import qualified Reporting.Exit.Make as Make
23−import qualified Reporting.Exit.Init as Init
24−import qualified Reporting.Exit.Install as Install
25−import qualified Reporting.Exit.Publish as Publish
@@ -30,44 +52,605 @@ import qualified Reporting.Exit.Publish as Publish
33− = NoElmJson
55+ -- bump
34− | Assets Asset.Exit
56+ = BumpApplication
35− | Bump Bump.Exit
57+ | BumpUnexpectedVersion V.Version [V.Version]
36− | Compile Compile.Exit [Compile.Exit]
58+ | BumpMustHaveLatestRegistry RegistryProblem
37− | Crawl Crawl.Exit
59+ | BumpCannotFindDocs Pkg.Name V.Version DocsProblem
38− | Cycle [ModuleName.Raw] -- TODO write docs to help with this scenario
60+ -- publish
39− | Deps Deps.Exit
61+ | PublishMustHaveLatestRegistry RegistryProblem
40− | Diff Diff.Exit
62+ | PublishApplication
63+ | PublishNotInitialVersion V.Version
64+ | PublishAlreadyPublished V.Version
65+ | PublishInvalidBump V.Version V.Version
66+ | PublishBadBump V.Version V.Version M.Magnitude V.Version M.Magnitude
72+ | PublishCannotGetTag Http.Error
73+ | PublishCannotGetZip Http.Error
74+ | PublishCannotDecodeZip
75+ | PublishCannotGetDocs DocsProblem
76+ | PublishCannotRegister Http.Error
77+ | PublishMissingTag V.Version
79+ | PublishLocalChanges V.Version
93+ = InitNoSolution [Pkg.Name]
95+ | InitRegistryProblem RegistryProblem
98+initToReport :: Init -> Help.Report
101+ InitNoSolution pkgs ->
102+ Help.report "NO SOLUTION" Nothing
103+ "I tried to create an elm.json with the following direct dependencies:"
104+ [ D.indent 4 $ D.vcat $
105+ map (D.dullyellow . D.fromChars . Pkg.toChars) pkgs
107+ "I could not find compatible versions though! This should not happen, so please\
108+ \ ask around one of the community forums at https://elm-lang.org/community to learn\
109+ \ what is going on!"
112+ InitAlreadyExists ->
113+ Help.report "EXISTING PROJECT" Nothing
114+ "You already have an elm.json file, so there is nothing for me to initialize!"
116+ ["Maybe",D.green (D.fromChars (D.makeLink "init")),"can","help"
117+ ,"you","figure","out","what","to","do","next?"
121+ InitRegistryProblem _ ->
122+ error "TODO InitRegistryProblem"
132+ | DiffUnknownPackage Pkg.Name [Pkg.Name]
133+ | DiffUnknownVersion Pkg.Name V.Version [V.Version]
134+ | DiffCannotFindDocs DocsProblem
135+ | DiffMustHaveLatestRegistry RegistryProblem
138+diffToReport :: Diff -> Help.Report
142+ Help.report "CANNOT DIFF APPLICATIONS" Nothing
143+ "I cannot perform diffs on applications, only packages! If you are\
144+ \ just curious to see a diff, try running this command:"
145+ [ D.indent 4 $ D.green $ "elm diff elm/html 5.1.1 6.0.0"
149+ Help.report "UNPUBLISHED" Nothing
150+ "This package is not published yet. There is nothing to diff against!"
153+ DiffUnknownPackage pkg suggestions ->
154+ Help.report "UNKNOWN PACKAGE" Nothing
155+ ( "I cannot find a package called:"
157+ [ D.indent 4 $ D.red $ D.fromUtf8 $ Pkg.toString pkg
158+ , "Maybe you want one of these instead?"
159+ , D.indent 4 $ D.dullyellow $ D.vcat $ map (D.fromUtf8 . Pkg.toString) suggestions
160+ , "But check <https://package.elm-lang.org> to see all possibilities!"
163+ DiffUnknownVersion _pkg vsn realVersions ->
164+ Help.docReport "UNKNOWN VERSION" Nothing
166+ [ "Version", D.red (D.fromUtf8 (V.toString vsn))
167+ , "has", "never", "been", "published,", "so", "I"
168+ , "cannot", "diff", "against", "it."
171+ [ "Here are all the versions that HAVE been published:"
172+ , D.indent 4 $ D.dullyellow $ D.vcat $
174+ sameMajor v1 v2 = V._major v1 == V._major v2
175+ mkRow vsns = D.hsep $ map (D.fromUtf8 . V.toString) vsns
177+ map mkRow $ List.groupBy sameMajor (List.sort realVersions)
178+ , "Want one of those instead?"
181+ DiffCannotFindDocs problem ->
182+ error "TODO DiffCannotFindDocs" problem
184+ DiffMustHaveLatestRegistry problem ->
185+ error "TODO DiffMustHaveLatestRegistry" problem
193+ = InstallNoArgs FilePath
194+ | InstallNoSolution [Pkg.Name]
197+installToReport :: Install -> Help.Report
198+installToReport exit =
200+ InstallNoArgs elmHome ->
201+ Help.report "INSTALL WHAT?" Nothing
202+ "I am expecting commands like:"
203+ [ D.green $ D.indent 4 $ D.vcat $
204+ [ "elm install elm/http"
205+ , "elm install elm/json"
206+ , "elm install elm/random"
209+ ["In","JavaScript","folks","run","`npm install`","to","start","projects."
210+ ,"\"Gotta","download","everything!\"","But","why","download","packages"
211+ ,"again","and","again?","Instead,","Elm","caches","packages","in"
212+ ,D.dullyellow (D.fromChars elmHome)
213+ ,"so","each","one","is","downloaded","and","built","ONCE","on","your","machine."
214+ ,"Elm","projects","check","that","cache","before","trying","the","internet."
215+ ,"This","reduces","build","times,","reduces","server","costs,","and","makes","it"
216+ ,"easier","to","work","offline.","As","a","result"
217+ ,D.dullcyan "elm install","is","only","for","adding","dependencies","to","elm.json,"
218+ ,"whereas",D.dullcyan "elm make","is","in","charge","of","gathering","dependencies"
219+ ,"and","building","everything.","So","maybe","try",D.green "elm make","instead?"
223+ InstallNoSolution badPackages ->
226+ Help.report "UNSOLVABLE DEPENDENCIES" (Just "elm.json") -- TODO give better advice!
227+ "This usually happens if you try to modify dependency constraints by\
228+ \ hand. I recommend deleting any dependency you added recently (or all\
229+ \ of them if things are bad) and then adding them again with:"
230+ [ D.indent 4 $ D.green "elm install"
232+ "And do not be afaid to ask for help on Slack if you get stuck!"
236+ Help.report "OLD DEPENDENCIES" (Just "elm.json")
237+ ( "The following packages do not work with Elm " ++ V.toChars V.compiler ++ " right now:"
239+ [ D.indent 4 $ D.vcat $ map (D.red . D.fromUtf8 . Pkg.toString) badPackages
241+ "This may be because it is not upgraded yet. It may be because a\
242+ \ better solution came along, so there was no need to upgrade it.\
243+ \ Etc. Try asking around on Slack to learn more about the topic."
245+ "Whatever the case, please be kind to the relevant package authors! Having\
246+ \ friendly interactions with users is great motivation, and conversely, getting\
247+ \ berated by strangers on the internet sucks your soul dry. Furthermore, package\
248+ \ authors are humans with families, friends, jobs, vacations, responsibilities,\
249+ \ goals, etc. They face obstacles outside of their technical work you will never\
250+ \ know about, so please assume the best and try to be patient and supportive!"
260+ | DetailsBadElmInPkg C.Constraint
261+ | DetailsBadElmInAppOutline V.Version
262+ | DetailsHandEditedDependencies
263+ | DetailsBadOutline OutlineProblem
264+ | DetailsCannotGetRegistry RegistryProblem
265+ | DetailsCannotBuildPackage Pkg.Name V.Version PackageProblem
269+ = BadOutlineStructure (Json.Error OutlineStructureProblem)
270+ | BadOutlineSrcDirs FilePath [FilePath]
273+data OutlineStructureProblem
274+ = OSP_BadType Utf8.String
275+ | OSP_BadPkgName Pkg.BadName
276+ | OSP_BadVersion Utf8.String
277+ | OSP_BadConstraint C.Error
278+ | OSP_BadModuleName Utf8.String
279+ | OSP_BadModuleHeaderTooLong Utf8.String
280+ | OSP_BadDependencyName Utf8.String
281+ | OSP_BadLicense Utf8.String [Utf8.String]
282+ | OSP_BadSummaryTooLong
286+ = RP_Http Http.Error
291+ = PP_BadEndpointRequest Http.Error
292+ | PP_BadEndpointContent
293+ | PP_BadArchiveRequest Http.Error
294+ | PP_BadArchiveContent
295+ | PP_BadArchiveHash String String
41− | Make Make.Exit
302+data Make
42− | Init Init.Exit
303+ = MakeNeedsOutline
43− | Install Install.Exit
304+ | MakeCannotOptimizeAndDebug
44− | Publish Publish.Exit
305+ | MakeBlockedByDetailsProblem Details
45− | BadHttp String Http.Exit
306+ | MakeAppNeedsFileNames
307+ | MakePkgNeedsExposing
308+ | MakeMultipleFilesIntoHtml
309+ | MakeNonMainFilesIntoJavaScript ModuleName.Raw [ModuleName.Raw]
310+ | MakeCannotOptimizeDebugValues ModuleName.Raw [ModuleName.Raw]
311+ | MakeCannotBuild BuildProblem
312+ | MakeCannotLoadArtifacts
316+ = BuildModuleProblems Problem.Problem [Problem.Problem]
317+ | BuildProjectProblem BuildProjectProblem
320+data BuildProjectProblem
321+ = BP_PathUnknown FilePath
322+ | BP_WithBadExtension FilePath
323+ | BP_WithAmbiguousSrcDir FilePath FilePath
324+ | BP_MainPathDuplicate FilePath FilePath
325+ | BP_MainNameDuplicate ModuleName.Raw FilePath FilePath
326+ | BP_CannotLoadDependencies
327+ | BP_Cycle ModuleName.Raw [ModuleName.Raw]
49-- RENDERERS
331-- RENDERERS
52−toString :: Exit -> String
334+toString :: Help.Report -> String
53−toString exit =
335+toString report =
54− Help.toString (Help.reportToDoc (toReport exit))
336+ Help.toString (Help.reportToDoc report)
57−toStderr :: Exit -> IO ()
339+toStderr :: Help.Report -> IO ()
58−toStderr exit =
340+toStderr report =
59− Help.toStderr (Help.reportToDoc (toReport exit))
341+ Help.toStderr (Help.reportToDoc report)
62−toJson :: Exit -> Encode.Value
344+toJson :: Help.Report -> Encode.Value
63−toJson exit =
345+toJson report =
64− Help.reportToJson (toReport exit)
346+ Help.reportToJson report
67−toReport :: Exit -> Help.Report
349+_toReport :: Exit -> Help.Report
68−toReport exit =
350+_toReport exit =
69 case exit of
351 case exit of
356+ Help.report "CANNOT BUMP APPLICATIONS" (Just "elm.json")
357+ "Your elm.json says this is an application. That means it cannot be published\
358+ \ on <https://package.elm-lang.org> and therefore has no version to bump!"
361+ BumpUnexpectedVersion vsn versions ->
362+ Help.docReport "CANNOT BUMP" (Just "elm.json")
364+ ["Your","elm.json","says","I","should","bump","relative","to","version"
365+ ,D.red (D.fromUtf8 (V.toString vsn)) <> ","
366+ ,"but","I","cannot","find","that","version","on","<https://package.elm-lang.org>."
367+ ,"That","means","there","is","no","API","for","me","to","diff","against","and"
368+ ,"figure","out","if","these","are","MAJOR,","MINOR,","or","PATCH","changes."
372+ ["Try","bumping","again","after","changing","the",D.dullyellow "\"version\"","in","elm.json"]
373+ ++ if length versions == 1 then ["to:"] else ["to","one","of","these:"]
374+ , D.vcat $ map (D.green . D.fromUtf8 . V.toString) versions
377+ BumpMustHaveLatestRegistry problem ->
378+ error "TODO BumpMustHaveLatestRegistry" problem
380+ BumpCannotFindDocs name version problem ->
381+ error "TODO BumpCannotFindDocs" name version problem
385+ PublishMustHaveLatestRegistry problem ->
386+ error "TODO PublishMustHaveLatestRegistry" problem
388+ PublishApplication ->
389+ Help.report "UNPUBLISHABLE" Nothing "I cannot publish applications, only packages!" []
391+ PublishNotInitialVersion vsn ->
392+ Help.docReport "INVALID VERSION" Nothing
394+ ["I","cannot","publish"
395+ ,D.red (D.fromUtf8 (V.toString vsn))
396+ ,"as","the","initial","version."
400+ ["Change","it","to",D.green "1.0.0","which","is"
401+ ,"the","initial","version","for","all","Elm","packages."
405+ PublishAlreadyPublished vsn ->
406+ Help.docReport "ALREADY PUBLISHED" Nothing
409+ [ "Version", D.green (D.fromUtf8 (V.toString vsn))
410+ , "has", "already", "been", "published.", "You", "cannot"
411+ , "publish", "it", "again!"
413+ , "Try using the `bump` command:"
416+ [ D.dullyellow $ D.indent 4 "elm bump"
418+ "It computes the version number based on API changes, ensuring\
419+ \ that no breaking changes end up in PATCH releases!"
422+ PublishInvalidBump statedVersion latestVersion ->
423+ Help.docReport "INVALID VERSION" (Just "elm.json")
425+ ["Your","elm.json","says","the","next","version","should","be"
426+ ,D.red (D.fromUtf8 (V.toString statedVersion)) <> ","
427+ ,"but","that","is","not","valid","based","on","the","previously"
428+ ,"published","versions."
432+ ["Change","the","version","back","to"
433+ ,D.green (D.fromUtf8 (V.toString latestVersion))
434+ ,"which","is","the","most","recently","published","version."
435+ ,"From","there,","have","Elm","bump","the","version","by","running:"
437+ , D.indent 4 $ D.green "elm bump"
439+ "If you want more insight on the API changes Elm detects, you\
440+ \ can run `elm diff` at this point as well."
443+ PublishBadBump old new magnitude realNew realMagnitude ->
444+ Help.docReport "INVALID VERSION" (Just "elm.json")
447+ ["Your","elm.json","says","the","next","version","should","be"
448+ ,D.red (D.fromUtf8 (V.toString new)) <> ","
449+ ,"indicating","a",D.fromChars (M.toChars magnitude)
450+ ,"change","to","the","public","API."
451+ ,"This","does","not","match","the","API","diff","given","by:"
454+ [ D.indent 4 $ D.fromChars $
455+ "elm diff " ++ V.toChars old
458+ ["This","command","says","this","is","a"
459+ ,D.fromChars (M.toChars realMagnitude)
460+ ,"change,","so","the","next","version","should","be"
461+ ,D.green (D.fromUtf8 (V.toString realNew)) <> "."
462+ ,"Double","check","everything","to","make","sure","you"
463+ ,"are","publishing","what","you","want!"
466+ "Also, next time use `elm bump` and I'll figure all this out for you!"
470+ Help.docReport "NO SUMMARY" (Just "elm.json")
472+ [ "To", "publish", "a", "package,", "your", "elm.json", "must"
473+ , "have", "a", D.dullyellow "\"summary\"", "field", "that", "gives"
474+ , "a", "consice", "overview", "of", "your", "project."
478+ "The summary must be less than 80 characters. It should describe\
479+ \ the concrete use of your package as clearly and as plainly as possible."
483+ Help.docReport "NO EXPOSED MODULES" (Just "elm.json")
485+ [ "To", "publish", "a", "package,", "the"
486+ , D.dullyellow "\"exposed-modules\"", "field", "of", "your"
487+ , "elm.json", "must", "list", "at", "least", "one", "module."
491+ "What is the point of a package that has no modules?!"
495+ badReadmeReport "NO README" $
496+ "Every published package must have a helpful README.md\
497+ \ file, but I do not see one in your project."
499+ PublishShortReadme ->
500+ badReadmeReport "SHORT README" $
501+ "This README.md is too short. Having more details will help\
502+ \ people assess your package quickly and fairly."
505+ Help.report "NO LICENSE FILE" (Just "LICENSE")
506+ "By publishing a package you are inviting the Elm community to build\
507+ \ upon your work. But without knowing your license, we have no idea if\
510+ "Once you pick an OSI approved license from <https://spdx.org/licenses/>,\
511+ \ you must share that choice in two places. First, the license\
512+ \ identifier must appear in your elm.json file. Second, the full\
513+ \ license text must appear in the root of your project in a file\
514+ \ named LICENSE. Add that file and you will be all set!"
517+ PublishCannotGetTag httpError ->
518+ error "TODO PublishCannotGetTag" httpError
520+ PublishCannotGetZip httpError ->
521+ error "TODO PublishCannotGetZip" httpError
523+ PublishCannotDecodeZip ->
524+ error "TODO PublishCannotDecodeZip"
526+ PublishCannotGetDocs docsProblem ->
527+ error "TODO PublishCannotGetDocs" docsProblem
529+ PublishCannotRegister httpError ->
530+ error "TODO PublishCannotRegister" httpError
532+ PublishMissingTag version ->
533+ let vsn = V.toChars version in
534+ Help.docReport "NO TAG" Nothing
536+ [ "Packages", "must", "be", "tagged", "in", "git,", "but", "I"
537+ , "cannot", "find", "a", D.green (D.fromChars vsn), "tag."
541+ [ "These tags make it possible to find this specific version on GitHub."
542+ , "To tag the most recent commit and push it to GitHub, run this:"
544+ , D.indent 4 $ D.dullyellow $ D.vcat $ map D.fromChars $
545+ [ "git tag -a " ++ vsn ++ " -m \"new release\""
546+ , "git push origin " ++ vsn
548+ , "The -m flag is for a helpful message. Try to make it more informative!"
552+ Help.report "NO GIT" Nothing
553+ "I searched your PATH environment variable for `git` and could not\
554+ \ find it. Is it available through your PATH?"
556+ "Who cares about this? Well, I currently use `git` to check if there\
557+ \ are any local changes in your code. Local changes are a good sign\
558+ \ that some important improvements have gotten mistagged, so this\
559+ \ check can be extremely helpful for package authors!"
561+ "We plan to do this without the `git` binary in a future release."
564+ PublishLocalChanges version ->
565+ let vsn = V.toChars version in
566+ Help.docReport "LOCAL CHANGES" Nothing
568+ [ "The", "code", "tagged", "as", D.green (D.fromChars vsn), "in"
569+ , "git", "does", "not", "match", "the", "code", "in", "your"
570+ , "working", "directory.", "This", "means", "you", "have"
571+ , "commits", "or", "local", "changes", "that", "are", "not"
572+ , "going", "to", "be", "published!"
576+ "If you are sure everything is in order, you can run `git checkout "
577+ ++ vsn ++ "` and publish your code from there."
581+badReadmeReport :: String -> String -> Help.Report
582+badReadmeReport title summary =
583+ Help.report title (Just "README.md") summary
585+ "When people look at your README, they are wondering:"
587+ [ " - What does this package even do?"
588+ , " - Will it help me solve MY problems?"
591+ "So I recommend starting your README with a small example of the\
592+ \ most common usage scenario. Show people what they can expect if\
595+ "By publishing your package, you are inviting people to invest time\
596+ \ in understanding your work. Spending an hour to communicate your\
597+ \ knowledge more clearly can save the community days or weeks of time\
598+ \ in aggregate, and saving time in aggregate is the whole point of\
599+ \ publishing packages! People really appreciate it, and it makes the\
600+ \ whole ecosystem feel nicer!"
608+detailsToReport :: Details -> Help.Report
609+detailsToReport details =
612+ error "TODO DetailsCorrupt"
614+ DetailsBadElmInPkg constraint ->
615+ Help.report "ELM VERSION MISMATCH" (Just "elm.json")
616+ "Your elm.json says this package needs a version of Elm in this range:"
617+ [ D.indent 4 $ D.dullyellow $ D.fromUtf8 $ C.toString constraint
619+ [ "But", "you", "are", "using", "Elm"
620+ , D.red (D.fromUtf8 (V.toString V.compiler))
625+ DetailsBadElmInAppOutline version ->
626+ Help.report "ELM VERSION MISMATCH" (Just "elm.json")
627+ "Your elm.json says this application needs a different version of Elm."
630+ , D.green (D.fromUtf8 (V.toString version)) <> ","
631+ , "but", "you", "are", "using"
632+ , D.red (D.fromUtf8 (V.toString V.compiler))
637+ DetailsHandEditedDependencies ->
638+ error "TODO DetailsHandEditedDependencies"
640+ DetailsBadOutline problem ->
641+ error "TODO DetailsBadOutline" problem
643+ DetailsCannotGetRegistry problem ->
644+ error "TODO DetailsCannotGetRegistry" problem
646+ DetailsCannotBuildPackage name version problem ->
647+ error "TODO DetailsCannotBuildPackage" name version problem
650+makeToReport :: Make -> Help.Report
71 Help.report "NO elm.json FILE" Nothing
654 Help.report "NO elm.json FILE" Nothing
72 "It looks like you are starting a new Elm project. Very exciting! Try running:"
655 "It looks like you are starting a new Elm project. Very exciting! Try running:"
73 [ D.indent 4 $ D.green $ "elm init"
656 [ D.indent 4 $ D.green $ "elm init"
@@ -75,44 +658,83 @@ toReport exit =
75 "It will help you get set up. It is really simple!"
658 "It will help you get set up. It is really simple!"
78− Assets assetExit ->
661+ MakeCannotOptimizeAndDebug ->
79− Asset.toReport assetExit
662+ Help.docReport "CLASHING FLAGS" Nothing
81− Bump bumpExit ->
664+ ["I","cannot","compile","with",D.red "--optimize","and"
82− Bump.toReport bumpExit
665+ ,D.red "--debug","at","the","same","time."
84− Compile e es ->
667+ )
85− Help.compilerReport e es
668+ [ D.reflow
669+ "I need to take away information to optimize things, and I need to\
670+ \ add information to add the debugger. It is impossible to do both\
671+ \ at once though! Pick just one of those flags and it should work!"
87− Crawl crawlExit ->
674+ MakeBlockedByDetailsProblem detailsProblem ->
88− Crawl.toReport crawlExit
675+ detailsToReport detailsProblem
90− Cycle names ->
677+ MakeAppNeedsFileNames ->
91− Help.report "IMPORT CYCLE" Nothing
678+ Help.report "NO INPUT" Nothing
92− "Your module imports form a cycle:"
679+ "What should I make though? I need a specific file like this:"
93− [ D.cycle 4 names
680+ [ D.indent 4 $ D.green "elm make src/Main.elm"
94− , D.reflow $
681+ , D.reflow
95− "Learn more about why this is disallowed and how to break cycles here:"
682+ "However many files you give, I will create one JS file out of them."
96− ++ D.makeLink "import-cycles"
99− Deps depsExit ->
685+ MakePkgNeedsExposing ->
100− Deps.toReport depsExit
686+ error "TODO MakePkgNeedsExposing"
688+ MakeMultipleFilesIntoHtml ->
689+ error "TODO MakeMultipleFilesIntoHtml"
102− Diff commandsExit ->
691+ MakeNonMainFilesIntoJavaScript _ _ ->
103− Diff.toReport commandsExit
692+ error "TODO MakeNonMainFilesIntoJavaScript"
105− Make makeExit ->
694+ MakeCannotOptimizeDebugValues m ms ->
106− Make.toReport makeExit
695+ Help.report "DEBUG REMNANTS" Nothing
696+ "There are uses of the `Debug` module in the following modules:"
697+ [ D.indent 4 $ D.red $ D.vcat $ map (D.fromChars . ModuleName.toChars) (m:ms)
698+ , D.reflow "But the --optimize flag only works if all `Debug` functions are removed!"
700+ "The issue is that --optimize strips out info needed by `Debug` functions.\
701+ \ Here are two examples:"
702+ , D.indent 4 $ D.reflow $
703+ "(1) It shortens record field names. This makes the generated JavaScript is\
704+ \ smaller, but `Debug.toString` cannot know the real field names anymore."
705+ , D.indent 4 $ D.reflow $
706+ "(2) Values like `type Height = Height Float` are unboxed. This reduces\
707+ \ allocation, but it also means that `Debug.toString` cannot tell if it is\
708+ \ looking at a `Height` or `Float` value."
710+ "There are a few other cases like that, and it will be much worse once we start\
711+ \ inlining code. That optimization could move `Debug.log` and `Debug.todo` calls,\
712+ \ resulting in unpredictable behavior. I hope that clarifies why this restriction\
108− Init initExit ->
716+ MakeCannotBuild buildProblem ->
109− Init.toReport initExit
717+ case buildProblem of
718+ BuildProjectProblem bp ->
720+ BP_PathUnknown _ -> error "TODO BP_PathUnknown"
721+ BP_WithBadExtension _ -> error "TODO BP_WithBadExtension"
722+ BP_WithAmbiguousSrcDir _ _ -> error "TODO BP_WithAmbiguousSrcDir"
723+ BP_MainPathDuplicate _ _ -> error "TODO BP_MainPathDuplicate"
724+ BP_MainNameDuplicate _ _ _ -> error "TODO BP_MainNameDuplicate"
725+ BP_CannotLoadDependencies -> error "TODO BP_CannotLoadDependencies"
726+ BP_Cycle name names ->
727+ Help.report "IMPORT CYCLE" Nothing
728+ "Your module imports form a cycle:"
729+ [ D.cycle 4 name names
731+ "Learn more about why this is disallowed and how to break cycles here:"
732+ ++ D.makeLink "import-cycles"
111− Install installExit ->
112− Install.toReport installExit
114− Publish publishExit ->
736+ BuildModuleProblems p ps ->
115− Publish.toReport publishExit
737+ error "TODO MakeCannotBuild" p ps
117− BadHttp url httpExit ->
739+ MakeCannotLoadArtifacts ->
118− Http.toReport url httpExit
740+ error "TODO MakeCannotLoadArtifacts"