1{-# OPTIONS_GHC -Wall #-}
2{-# LANGUAGE OverloadedStrings #-}
11import qualified Text.PrettyPrint.ANSI.Leijen as P
13import qualified Elm.Compiler as Compiler
14import qualified Elm.Compiler.Module as Module
15import qualified Elm.Package as Pkg
16import qualified Elm.Utils as Utils
17import qualified Reporting.Error.Assets as Asset
18import qualified Reporting.Error.Bump as Bump
19import qualified Reporting.Error.Compile as Compile
20import qualified Reporting.Error.Crawl as Crawl
21import qualified Reporting.Error.Deps as Deps
22import qualified Reporting.Error.Diff as Diff
23import qualified Reporting.Error.Help as Help
24import qualified Reporting.Error.Http as Http
25import qualified Reporting.Error.Publish as Publish
36 | Compile Compile.Error [Compile.Error]
38 | Cycle [Module.Raw] -- TODO write docs to help with this scenario
41 | Publish Publish.Error
42 | BadHttp String Http.Error
45 | NoSolution [Pkg.Name]
53toString :: Error -> String
55 Help.toString (Help.reportToDoc (toReport err))
58toStderr :: Error -> IO ()
60 Help.toStderr (Help.reportToDoc (toReport err))
63toReport :: Error -> Help.Report
67 Help.report "WELCOME" Nothing
68 "It looks like you are trying to start a new Elm project. Very exciting! :D"
70 ["I","very","highly","recommend","working","through"
71 ,P.green "<https://guide.elm-lang.org>","which","will","teach","you","the"
72 ,"basics","of","Elm,","including","how","to","start","new","projects."
75 ["For","folks","who","have","already","built","stuff","with","Elm,","the"
76 ,"problem","is","just","that","there","is","no",P.dullyellow "elm.json","yet."
77 ,"If","you","want","to","work","from","an","example,","check","out","the"
78 ,"one","at","<https://github.com/evancz/elm-todomvc/blob/master/elm.json>"
81 "Whatever your scenario, I hope you have a lovely time using Elm!"
85 Asset.toReport assetError
88 Bump.toReport bumpError
91 Help.compilerReport $ Compile.toDoc e es
94 Crawl.toReport crawlError
97 Help.report "IMPORT CYCLE" Nothing
98 "Your module imports form a cycle:"
99 [ P.indent 4 (Utils.drawCycle names)
101 "Learn more about why this is disallowed and how to break cycles here:"
102 ++ Help.hintLink "import-cycles"
106 Deps.toReport depsError
108 Diff commandsError ->
109 Diff.toReport commandsError
111 Publish publishError ->
112 Publish.toReport publishError
114 BadHttp url httpError ->
115 Http.toReport url httpError
117 NoSolution badPackages ->
120 Help.report "UNSOLVABLE DEPENDENCIES" (Just "elm.json")
121 "This usually happens if you try to modify dependency constraints by\
122 \ hand. I recommend deleting any dependency you added recently (or all\
123 \ of them if things are bad) and then adding them again with:"
124 [ P.indent 4 $ P.green "elm install"
126 "And do not be afaid to ask for help on Slack if you get stuck!"
130 Help.report "OLD DEPENDENCIES" (Just "elm.json")
131 ( "You are using Elm " ++ Pkg.versionToString Compiler.version
132 ++ ", but the following packages have not been updated for this version yet:"
134 [ P.vcat $ map (P.red . P.text . Pkg.toString) badPackages
136 "Please be kind to the relevant package authors! Having friendly interactions\
137 \ with users is great motivation, and conversely, getting berated by strangers\
138 \ on the internet sucks your soul dry. Furthermore, package authors are humans\
139 \ with families, friends, jobs, vacations, responsibilities, goals, etc. They\
140 \ face obstacles outside of their technical work you will never know about,\
141 \ so please assume the best and try to be patient and supportive!"
145 Help.report "NO INPUT" Nothing
146 "What should I make though? I need more information, like:"
148 [ P.indent 4 $ P.green "elm make MyThing.elm"
149 , P.indent 4 $ P.green "elm make This.elm That.elm"
152 "However many files you give, I will create one JS file out of them."
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list