@@ -11,9 +11,12 @@ module Reporting.Exit
11 , Install(..)
11 , Install(..)
12 , installToReport
12 , installToReport
14− , Details(..)
14+ , Solver(..)
15 , OutlineProblem(..)
17 , OutlineProblem(..)
16− , OutlineStructureProblem(..)
18+ --
17 , RegistryProblem(..)
20 , RegistryProblem(..)
18 , PackageProblem(..)
21 , PackageProblem(..)
@@ -91,6 +94,8 @@ data DocsProblem
93 = InitNoSolution [Pkg.Name]
96 = InitNoSolution [Pkg.Name]
97+ | InitNoOfflineSolution [Pkg.Name]
98+ | InitSolverProblem Solver
94 | InitAlreadyExists
99 | InitAlreadyExists
95 | InitRegistryProblem RegistryProblem
100 | InitRegistryProblem RegistryProblem
@@ -109,6 +114,16 @@ initToReport exit =
109 \ what is going on!"
114 \ what is going on!"
117+ InitNoOfflineSolution pkgs ->
118+ Help.report "NO OFFLINE SOLUTION" Nothing
119+ (error "TODO InitNoOfflineSolution" pkgs)
120+ (error "TODO InitNoOfflineSolution" pkgs)
121+ -- note about Russia IP addresses?
122+ -- ask if they are on a plane or train
124+ InitSolverProblem solver ->
125+ error "TODO InitSolverProblem" solver
112 InitAlreadyExists ->
127 InitAlreadyExists ->
113 Help.report "EXISTING PROJECT" Nothing
128 Help.report "EXISTING PROJECT" Nothing
114 "You already have an elm.json file, so there is nothing for me to initialize!"
129 "You already have an elm.json file, so there is nothing for me to initialize!"
@@ -192,7 +207,12 @@ diffToReport diff =
192data Install
207data Install
193 = InstallNoProject
208 = InstallNoProject
194 | InstallNoArgs FilePath
209 | InstallNoArgs FilePath
195− | InstallNoSolution [Pkg.Name]
210+ | InstallNoOnlineSolution
211+ | InstallNoOfflineSolution
212+ | InstallHadSolverTrouble Solver
213+ | InstallUnknownPackageOnline [Pkg.Name]
214+ | InstallUnknownPackageOffline [Pkg.Name]
215+ | InstallHasBadDetails Details
198installToReport :: Install -> Help.Report
218installToReport :: Install -> Help.Report
@@ -200,8 +220,10 @@ installToReport exit =
200 case exit of
220 case exit of
201 InstallNoProject ->
221 InstallNoProject ->
202 Help.report "NEW PROJECT?" Nothing
222 Help.report "NEW PROJECT?" Nothing
203− (error "TODO InstallNoProject")
223+ "Are you trying to start a new project? Try this command instead:"
204− (error "TODO InstallNoProject details")
224+ [ D.indent 4 $ D.green "elm init"
225+ , D.reflow "It will help you get started!"
206 InstallNoArgs elmHome ->
228 InstallNoArgs elmHome ->
207 Help.report "INSTALL WHAT?" Nothing
229 Help.report "INSTALL WHAT?" Nothing
@@ -226,35 +248,81 @@ installToReport exit =
229− InstallNoSolution badPackages ->
251+ InstallNoOnlineSolution ->
232− Help.report "UNSOLVABLE DEPENDENCIES" (Just "elm.json") -- TODO give better advice!
252+ Help.report "UNSOLVABLE DEPENDENCIES" (Just "elm.json") -- TODO recommend using solver in `elm reactor`
233− "This usually happens if you try to modify dependency constraints by\
253+ "This usually happens if you try to modify dependency constraints by\
234− \ hand. I recommend deleting any dependency you added recently (or all\
254+ \ hand. I recommend deleting any dependency you added recently (or all\
235− \ of them if things are bad) and then adding them again with:"
255+ \ of them if things are bad) and then adding them again with:"
236− [ D.indent 4 $ D.green "elm install"
256+ [ D.indent 4 $ D.green "elm install"
237− , D.reflow $
257+ , D.reflow $
238− "And do not be afaid to ask for help on Slack if you get stuck!"
258+ "And do not be afaid to ask for help on Slack if you get stuck!"
261+ InstallNoOfflineSolution ->
262+ error "TODO InstallNoOfflineSolution"
264+ InstallHadSolverTrouble solver ->
265+ error "TODO InstallHadSolverTrouble" solver
267+ InstallUnknownPackageOnline suggestions ->
268+ error "TODO InstallUnknownPackageOnline" suggestions
270+ InstallUnknownPackageOffline suggestions ->
271+ error "TODO InstallUnknownPackageOffline" suggestions
273+ InstallHasBadDetails _ ->
274+ error "TODO InstallHasBadDetails"
277+{- TODO detect if library has no 0.19.0 version. Maybe do this on website though?
278+ Help.report "OLD DEPENDENCIES" (Just "elm.json")
279+ ( "The following packages do not work with Elm " ++ V.toChars V.compiler ++ " right now:"
281+ [ D.indent 4 $ D.vcat $ map (D.red . D.fromUtf8 . Pkg.toString) badPackages
283+ "This may be because it is not upgraded yet. It may be because a\
284+ \ better solution came along, so there was no need to upgrade it.\
285+ \ Etc. Try asking around on Slack to learn more about the topic."
287+ "Whatever the case, please be kind to the relevant package authors! Having\
288+ \ friendly interactions with users is great motivation, and conversely, getting\
289+ \ berated by strangers on the internet sucks your soul dry. Furthermore, package\
290+ \ authors are humans with families, friends, jobs, vacations, responsibilities,\
291+ \ goals, etc. They face obstacles outside of their technical work you will never\
292+ \ know about, so please assume the best and try to be patient and supportive!"
242− Help.report "OLD DEPENDENCIES" (Just "elm.json")
298+-- SOLVER
243− ( "The following packages do not work with Elm " ++ V.toChars V.compiler ++ " right now:"
299+
245− [ D.indent 4 $ D.vcat $ map (D.red . D.fromUtf8 . Pkg.toString) badPackages
301+data Solver
246− , D.reflow $
302+ = SolverBadCacheData Pkg.Name V.Version
247− "This may be because it is not upgraded yet. It may be because a\
303+ | SolverBadHttpData Pkg.Name V.Version
248− \ better solution came along, so there was no need to upgrade it.\
304+ | SolverBadHttp Http.Error
249− \ Etc. Try asking around on Slack to learn more about the topic."
305+
250− , D.toSimpleNote
306+
251− "Whatever the case, please be kind to the relevant package authors! Having\
307+
252− \ friendly interactions with users is great motivation, and conversely, getting\
308+-- OUTLINE
253− \ berated by strangers on the internet sucks your soul dry. Furthermore, package\
309+
254− \ authors are humans with families, friends, jobs, vacations, responsibilities,\
310+
255− \ goals, etc. They face obstacles outside of their technical work you will never\
311+data Outline
256− \ know about, so please assume the best and try to be patient and supportive!"
312+ = OutlineHasBadStructure (Json.Error OutlineProblem)
257− ]
313+ | OutlineHasBadSrcDirs FilePath [FilePath]
317+ = OP_BadType Utf8.String
318+ | OP_BadPkgName Pkg.BadName
319+ | OP_BadVersion Utf8.String
320+ | OP_BadConstraint C.Error
321+ | OP_BadModuleName Utf8.String
322+ | OP_BadModuleHeaderTooLong Utf8.String
323+ | OP_BadDependencyName Utf8.String
324+ | OP_BadLicense Utf8.String [Utf8.String]
325+ | OP_BadSummaryTooLong
@@ -263,31 +331,17 @@ installToReport exit =
264data Details
332data Details
265 = DetailsCorrupt
333 = DetailsCorrupt
335+ | DetailsNoOfflineSolution
336+ | DetailsSolverProblem Solver
266 | DetailsBadElmInPkg C.Constraint
337 | DetailsBadElmInPkg C.Constraint
267 | DetailsBadElmInAppOutline V.Version
338 | DetailsBadElmInAppOutline V.Version
268 | DetailsHandEditedDependencies
339 | DetailsHandEditedDependencies
269− | DetailsBadOutline OutlineProblem
340+ | DetailsBadOutline Outline
270 | DetailsCannotGetRegistry RegistryProblem
341 | DetailsCannotGetRegistry RegistryProblem
271 | DetailsCannotBuildPackage Pkg.Name V.Version PackageProblem
342 | DetailsCannotBuildPackage Pkg.Name V.Version PackageProblem
275− = BadOutlineStructure (Json.Error OutlineStructureProblem)
276− | BadOutlineSrcDirs FilePath [FilePath]
279−data OutlineStructureProblem
280− = OSP_BadType Utf8.String
281− | OSP_BadPkgName Pkg.BadName
282− | OSP_BadVersion Utf8.String
283− | OSP_BadConstraint C.Error
284− | OSP_BadModuleName Utf8.String
285− | OSP_BadModuleHeaderTooLong Utf8.String
286− | OSP_BadDependencyName Utf8.String
287− | OSP_BadLicense Utf8.String [Utf8.String]
288− | OSP_BadSummaryTooLong
291data RegistryProblem
345data RegistryProblem
292 = RP_Http Http.Error
346 = RP_Http Http.Error
293 | RP_Data
347 | RP_Data
@@ -652,6 +706,16 @@ detailsToReport details =
652 DetailsCannotBuildPackage name version problem ->
706 DetailsCannotBuildPackage name version problem ->
653 error "TODO DetailsCannotBuildPackage" name version problem
707 error "TODO DetailsCannotBuildPackage" name version problem
709+ DetailsNoSolution ->
710+ error "TODO DetailsNoSolution"
712+ DetailsNoOfflineSolution ->
713+ error "TODO DetailsNoOfflineSolution"
715+ DetailsSolverProblem _ ->
716+ error "TODO DetailsSolverProblem"
656makeToReport :: Make -> Help.Report
720makeToReport :: Make -> Help.Report
657makeToReport make =
721makeToReport make =