on master help sign in
Switch to Elm.Version and away from Data.Text in some builder/* files
83cd588Evan Czaplicki
builder/src/Elm/Bump.hs+17−18
@@ -11,10 +11,9 @@ import qualified Data.List as List
11
11
12import qualified Deps.Cache as Cache
12import qualified Deps.Cache as Cache
13import qualified Deps.Diff as Diff
13import qualified Deps.Diff as Diff
14−import qualified Elm.Package as Pkg
15−import qualified Elm.Project as Project
16import qualified Elm.Project.Json as Project
14import qualified Elm.Project.Json as Project
17import qualified Elm.Project.Summary as Summary
15import qualified Elm.Project.Summary as Summary
16+import qualified Elm.Version as V
18import Reporting.Doc ((<>), (<+>))
17import Reporting.Doc ((<>), (<+>))
19import qualified Reporting.Doc as D
18import qualified Reporting.Doc as D
20import qualified Reporting.Exit as Exit
19import qualified Reporting.Exit as Exit
@@ -56,7 +55,7 @@ bump summary@(Summary.Summary root project _ _ _) =
56-- VALID BUMPS
55-- VALID BUMPS
57
56
58
57
59−toPossibleBumps :: [Pkg.Version] -> [(Pkg.Version, Pkg.Version, Diff.Magnitude)]
58+toPossibleBumps :: [V.Version] -> [(V.Version, V.Version, Diff.Magnitude)]
60toPossibleBumps publishedVersions =
59toPossibleBumps publishedVersions =
61 case publishedVersions of
60 case publishedVersions of
62 [] ->
61 [] ->
@@ -65,17 +64,17 @@ toPossibleBumps publishedVersions =
65 _ ->
64 _ ->
66 let
65 let
67 patchPoints =
66 patchPoints =
68− Pkg.filterLatest Pkg.majorAndMinor publishedVersions
67+ V.filterLatest V.majorAndMinor publishedVersions
69
68
70 minorPoints =
69 minorPoints =
71− Pkg.filterLatest Pkg._major publishedVersions
70+ V.filterLatest V._major publishedVersions
72
71
73 majorPoint =
72 majorPoint =
74 maximum publishedVersions
73 maximum publishedVersions
75 in
74 in
76− (majorPoint, Pkg.bumpMajor majorPoint, Diff.MAJOR)
75+ (majorPoint, V.bumpMajor majorPoint, Diff.MAJOR)
77− : map (\v -> (v, Pkg.bumpMinor v, Diff.MINOR)) minorPoints
76+ : map (\v -> (v, V.bumpMinor v, Diff.MINOR)) minorPoints
78− ++ map (\v -> (v, Pkg.bumpPatch v, Diff.PATCH)) patchPoints
77+ ++ map (\v -> (v, V.bumpPatch v, Diff.PATCH)) patchPoints
79
78
80
79
81
80
@@ -85,14 +84,14 @@ toPossibleBumps publishedVersions =
85checkNewPackage :: FilePath -> Project.PkgInfo -> Task.Task ()
84checkNewPackage :: FilePath -> Project.PkgInfo -> Task.Task ()
86checkNewPackage root info@(Project.PkgInfo _ _ _ version _ _ _ _) =
85checkNewPackage root info@(Project.PkgInfo _ _ _ version _ _ _ _) =
87 do liftIO $ putStrLn Terminal.newPackageOverview
86 do liftIO $ putStrLn Terminal.newPackageOverview
88− if version == Pkg.initialVersion
87+ if version == V.one
89 then
88 then
90 liftIO $ putStrLn "The version number in elm.json is correct so you are all set!"
89 liftIO $ putStrLn "The version number in elm.json is correct so you are all set!"
91 else
90 else
92− changeVersion root info Pkg.initialVersion $
91+ changeVersion root info V.one $
93 "It looks like the version in elm.json has been changed though!\n\
92 "It looks like the version in elm.json has been changed though!\n\
94 \Would you like me to change it back to "
93 \Would you like me to change it back to "
95− <> D.fromText (Pkg.versionToText Pkg.initialVersion) <> "? [Y/n] "
94+ <> D.fromUtf8 (V.toString V.one) <> "? [Y/n] "
96
95
97
96
98
97
@@ -100,16 +99,16 @@ checkNewPackage root info@(Project.PkgInfo _ _ _ version _ _ _ _) =
100
99
101
100
102suggestVersion :: Summary.Summary -> Project.PkgInfo -> Task.Task ()
101suggestVersion :: Summary.Summary -> Project.PkgInfo -> Task.Task ()
103−suggestVersion summary@(Summary.Summary root _ _ _ _) info@(Project.PkgInfo name _ _ version _ _ _ _) =
102+suggestVersion (Summary.Summary root _ _ _ _) info@(Project.PkgInfo name _ _ version _ _ _ _) =
104 do oldDocs <- Cache.getDocs name version
103 do oldDocs <- Cache.getDocs name version
105− newDocs <- Task.silently (Project.generateDocs summary)
104+ newDocs <- Task.silently (error "TODO Project.generateDocs summary")
106 let changes = Diff.diff oldDocs newDocs
105 let changes = Diff.diff oldDocs newDocs
107 let newVersion = Diff.bump changes version
106 let newVersion = Diff.bump changes version
108 changeVersion root info newVersion $
107 changeVersion root info newVersion $
109 let
108 let
110− old = D.fromText $ Pkg.versionToText version
109+ old = D.fromUtf8 $ V.toString version
111− new = D.fromText $ Pkg.versionToText newVersion
110+ new = D.fromUtf8 $ V.toString newVersion
112− mag = D.fromString $ Diff.magnitudeToString (Diff.toMagnitude changes)
111+ mag = D.fromChars $ Diff.magnitudeToString (Diff.toMagnitude changes)
113 in
112 in
114 "Based on your new API, this should be a" <+> D.green mag <+> "change (" <> old <> " => " <> new <> ")\n"
113 "Based on your new API, this should be a" <+> D.green mag <+> "change (" <> old <> " => " <> new <> ")\n"
115 <> "Bail out of this command and run 'elm diff' for a full explanation.\n"
114 <> "Bail out of this command and run 'elm diff' for a full explanation.\n"
@@ -121,7 +120,7 @@ suggestVersion summary@(Summary.Summary root _ _ _ _) info@(Project.PkgInfo name
121-- CHANGE VERSION
120-- CHANGE VERSION
122
121
123
122
124−changeVersion :: FilePath -> Project.PkgInfo -> Pkg.Version -> D.Doc -> Task.Task ()
123+changeVersion :: FilePath -> Project.PkgInfo -> V.Version -> D.Doc -> Task.Task ()
125changeVersion root info targetVersion explanation =
124changeVersion root info targetVersion explanation =
126 do approved <- Task.getApproval explanation
125 do approved <- Task.getApproval explanation
127 if not approved
126 if not approved
@@ -134,5 +133,5 @@ changeVersion root info targetVersion explanation =
134
133
135 liftIO $ Help.toStdout $
134 liftIO $ Help.toStdout $
136 "Version changed to "
135 "Version changed to "
137− <> D.green (D.fromText (Pkg.versionToText targetVersion))
136+ <> D.green (D.fromUtf8 (V.toString targetVersion))
138 <> "!\n"
137 <> "!\n"
builder/src/Elm/Install.hs+43−43
@@ -18,10 +18,10 @@ import Deps.Explorer (Explorer)
18import qualified Deps.Explorer as Explorer
18import qualified Deps.Explorer as Explorer
19import qualified Deps.Verify as Verify
19import qualified Deps.Verify as Verify
20import qualified Deps.Solver as Solver
20import qualified Deps.Solver as Solver
21−import Elm.Project.Constraint (Constraint)
22−import qualified Elm.Project.Constraint as Con
21+import qualified Elm.Constraint as C
23import qualified Elm.Project.Json as Project
22import qualified Elm.Project.Json as Project
24import qualified Elm.Project.Root as Root
23import qualified Elm.Project.Root as Root
24+import qualified Elm.Version as V
25import Reporting.Doc ((<>), (<+>))
25import Reporting.Doc ((<>), (<+>))
26import qualified Reporting.Doc as D
26import qualified Reporting.Doc as D
27import qualified Reporting.Exit as Exit
27import qualified Reporting.Exit as Exit
@@ -41,15 +41,15 @@ install pkg =
41 case oldProject of
41 case oldProject of
42 Project.App info ->
42 Project.App info ->
43 do changes <- makeAppPlan registry pkg info
43 do changes <- makeAppPlan registry pkg info
44− attemptElmJsonChange root oldProject Pkg.versionToString changes
44+ attemptElmJsonChange root oldProject V.toChars changes
45
45
46 Project.Pkg info ->
46 Project.Pkg info ->
47 do changes <- makePkgPlan registry pkg info
47 do changes <- makePkgPlan registry pkg info
48− attemptElmJsonChange root oldProject Con.toString changes
48+ attemptElmJsonChange root oldProject C.toChars changes
49
49
50
50
51attemptElmJsonChange :: FilePath -> Project.Project -> (a -> String) -> Changes a -> Task.Task ()
51attemptElmJsonChange :: FilePath -> Project.Project -> (a -> String) -> Changes a -> Task.Task ()
52−attemptElmJsonChange root oldProject toString changes =
52+attemptElmJsonChange root oldProject toChars changes =
53 let
53 let
54 attempt newProject question =
54 attempt newProject question =
55 do approved <- Task.getApproval question
55 do approved <- Task.getApproval question
@@ -97,8 +97,8 @@ attemptElmJsonChange root oldProject toString changes =
97
97
98 Changes changeDict newProject ->
98 Changes changeDict newProject ->
99 let
99 let
100− widths = Map.foldrWithKey (widen toString) (Widths 0 0 0) changeDict
100+ widths = Map.foldrWithKey (widen toChars) (Widths 0 0 0) changeDict
101− changeDocs = Map.foldrWithKey (addChange toString widths) (Docs [] [] []) changeDict
101+ changeDocs = Map.foldrWithKey (addChange toChars widths) (Docs [] [] []) changeDict
102 in
102 in
103 attempt newProject $ D.vcat $
103 attempt newProject $ D.vcat $
104 [ "Here is my plan:"
104 [ "Here is my plan:"
@@ -119,7 +119,7 @@ data Changes vsn
119 | Changes (Map.Map Pkg.Name (Change vsn)) Project.Project
119 | Changes (Map.Map Pkg.Name (Change vsn)) Project.Project
120
120
121
121
122−makeAppPlan :: Cache.PackageRegistry -> Pkg.Name -> Project.AppInfo -> Task.Task (Changes Pkg.Version)
122+makeAppPlan :: Cache.PackageRegistry -> Pkg.Name -> Project.AppInfo -> Task.Task (Changes V.Version)
123makeAppPlan registry pkg info@(Project.AppInfo _ _ depsDirect depsTrans testDirect testTrans) =
123makeAppPlan registry pkg info@(Project.AppInfo _ _ depsDirect depsTrans testDirect testTrans) =
124 if Map.member pkg depsDirect then
124 if Map.member pkg depsDirect then
125 return AlreadyInstalled
125 return AlreadyInstalled
@@ -137,7 +137,7 @@ makeAppPlan registry pkg info@(Project.AppInfo _ _ depsDirect depsTrans testDire
137 Changes (detectChanges old new) (Project.App newInfo)
137 Changes (detectChanges old new) (Project.App newInfo)
138
138
139
139
140−makePkgPlan :: Cache.PackageRegistry -> Pkg.Name -> Project.PkgInfo -> Task.Task (Changes Constraint)
140+makePkgPlan :: Cache.PackageRegistry -> Pkg.Name -> Project.PkgInfo -> Task.Task (Changes C.Constraint)
141makePkgPlan registry pkg info@(Project.PkgInfo _ _ _ _ _ deps test _) =
141makePkgPlan registry pkg info@(Project.PkgInfo _ _ _ _ _ deps test _) =
142 if Map.member pkg deps then
142 if Map.member pkg deps then
143 return AlreadyInstalled
143 return AlreadyInstalled
@@ -217,8 +217,8 @@ keepNew change =
217
217
218data AppAnswer =
218data AppAnswer =
219 AppAnswer
219 AppAnswer
220− { _old :: Map.Map Pkg.Name Pkg.Version
220+ { _old :: Map.Map Pkg.Name V.Version
221− , _new :: Map.Map Pkg.Name Pkg.Version
221+ , _new :: Map.Map Pkg.Name V.Version
222 , _info :: Project.AppInfo
222 , _info :: Project.AppInfo
223 }
223 }
224
224
@@ -252,8 +252,8 @@ toAppAnswerHelp pkg (Project.AppInfo elm srcDirs depsDirect depsTrans testDirect
252 Map.union directs (Map.union depsTrans testTrans)
252 Map.union directs (Map.union depsTrans testTrans)
253
253
254 try toConstraint deps =
254 try toConstraint deps =
255− do solution <- Solver.solve $ Map.insert pkg Con.anything (Map.map toConstraint deps)
255+ do solution <- Solver.solve $ Map.insert pkg C.anything (Map.map toConstraint deps)
256− let newDepsDirect = Map.intersection solution (Map.insert pkg Pkg.dummyVersion depsDirect)
256+ let newDepsDirect = Map.intersection solution (Map.insert pkg V.one depsDirect)
257 newDeps <- lift $ foldM (collectTransitive solution) Map.empty (Map.keys newDepsDirect)
257 newDeps <- lift $ foldM (collectTransitive solution) Map.empty (Map.keys newDepsDirect)
258 return $
258 return $
259 AppAnswer
259 AppAnswer
@@ -270,19 +270,19 @@ toAppAnswerHelp pkg (Project.AppInfo elm srcDirs depsDirect depsTrans testDirect
270 }
270 }
271 in
271 in
272 msum
272 msum
273− [ try Con.exactly directAndTrans
273+ [ try C.exactly directAndTrans
274− , try Con.exactly directs
274+ , try C.exactly directs
275− , try Con.untilNextMinor directs
275+ , try C.untilNextMinor directs
276− , try Con.untilNextMajor directs
276+ , try C.untilNextMajor directs
277− , try (\_ -> Con.anything) directs
277+ , try (\_ -> C.anything) directs
278 ]
278 ]
279
279
280
280
281collectTransitive
281collectTransitive
282− :: Map.Map Pkg.Name Pkg.Version
282+ :: Map.Map Pkg.Name V.Version
283− -> Map.Map Pkg.Name Pkg.Version
283+ -> Map.Map Pkg.Name V.Version
284 -> Pkg.Name
284 -> Pkg.Name
285− -> Explorer (Map.Map Pkg.Name Pkg.Version)
285+ -> Explorer (Map.Map Pkg.Name V.Version)
286collectTransitive solution state name =
286collectTransitive solution state name =
287 do let version = solution ! name
287 do let version = solution ! name
288 (Explorer.Info _ trans) <- Explorer.getConstraints name version
288 (Explorer.Info _ trans) <- Explorer.getConstraints name version
@@ -298,7 +298,7 @@ collectTransitive solution state name =
298-- ADD TO PKG
298-- ADD TO PKG
299
299
300
300
301−addToPkg :: Cache.PackageRegistry -> Pkg.Name -> Project.PkgInfo -> Task.Task (Map.Map Pkg.Name (Change Constraint))
301+addToPkg :: Cache.PackageRegistry -> Pkg.Name -> Project.PkgInfo -> Task.Task (Map.Map Pkg.Name (Change C.Constraint))
302addToPkg registry pkg info@(Project.PkgInfo _ _ _ _ _ deps tests _) =
302addToPkg registry pkg info@(Project.PkgInfo _ _ _ _ _ deps tests _) =
303 Explorer.run registry $
303 Explorer.run registry $
304 do Explorer.exists pkg
304 do Explorer.exists pkg
@@ -314,12 +314,12 @@ addToPkg registry pkg info@(Project.PkgInfo _ _ _ _ _ deps tests _) =
314 lift $ Task.throw (Exit.Install (E.NoSolution badNames))
314 lift $ Task.throw (Exit.Install (E.NoSolution badNames))
315
315
316
316
317−addToPkgHelp :: Pkg.Name -> Project.PkgInfo -> Solver.Solver (Map.Map Pkg.Name Constraint)
317+addToPkgHelp :: Pkg.Name -> Project.PkgInfo -> Solver.Solver (Map.Map Pkg.Name C.Constraint)
318addToPkgHelp pkg (Project.PkgInfo _ _ _ _ _ deps tests _) =
318addToPkgHelp pkg (Project.PkgInfo _ _ _ _ _ deps tests _) =
319 do let directs = Map.union deps tests
319 do let directs = Map.union deps tests
320− let newCons = Map.insert pkg Con.anything directs
320+ let newCons = Map.insert pkg C.anything directs
321 solution <- Solver.solve newCons
321 solution <- Solver.solve newCons
322− let con = Con.untilNextMajor (solution ! pkg)
322+ let con = C.untilNextMajor (solution ! pkg)
323 return $ Map.insert pkg con directs
323 return $ Map.insert pkg con directs
324
324
325
325
@@ -334,7 +334,7 @@ isBadElm name =
334 elmVersions <- forM versions $ \vsn ->
334 elmVersions <- forM versions $ \vsn ->
335 Explorer._elm <$> Explorer.getConstraints name vsn
335 Explorer._elm <$> Explorer.getConstraints name vsn
336
336
337− return (not (any Con.goodElm elmVersions))
337+ return (not (any C.goodElm elmVersions))
338
338
339
339
340
340
@@ -364,7 +364,7 @@ viewNonZero title entries =
364 []
364 []
365 else
365 else
366 [ ""
366 [ ""
367− , D.fromString title
367+ , D.fromChars title
368 , D.indent 2 (D.vcat entries)
368 , D.indent 2 (D.vcat entries)
369 ]
369 ]
370
370
@@ -374,46 +374,46 @@ viewNonZero title entries =
374
374
375
375
376addChange :: (a -> String) -> Widths -> Pkg.Name -> Change a -> ChangeDocs -> ChangeDocs
376addChange :: (a -> String) -> Widths -> Pkg.Name -> Change a -> ChangeDocs -> ChangeDocs
377−addChange toString widths name change (Docs inserts changes removes) =
377+addChange toChars widths name change (Docs inserts changes removes) =
378 case change of
378 case change of
379 Insert new ->
379 Insert new ->
380− Docs (viewInsert toString widths name new : inserts) changes removes
380+ Docs (viewInsert toChars widths name new : inserts) changes removes
381
381
382 Change old new ->
382 Change old new ->
383− Docs inserts (viewChange toString widths name old new : changes) removes
383+ Docs inserts (viewChange toChars widths name old new : changes) removes
384
384
385 Remove old ->
385 Remove old ->
386− Docs inserts changes (viewRemove toString widths name old : removes)
386+ Docs inserts changes (viewRemove toChars widths name old : removes)
387
387
388
388
389viewInsert :: (a -> String) -> Widths -> Pkg.Name -> a -> D.Doc
389viewInsert :: (a -> String) -> Widths -> Pkg.Name -> a -> D.Doc
390−viewInsert toString (Widths nameWidth leftWidth _) name new =
390+viewInsert toChars (Widths nameWidth leftWidth _) name new =
391− viewName nameWidth name <+> pad leftWidth (toString new)
391+ viewName nameWidth name <+> pad leftWidth (toChars new)
392
392
393
393
394viewChange :: (a -> String) -> Widths -> Pkg.Name -> a -> a -> D.Doc
394viewChange :: (a -> String) -> Widths -> Pkg.Name -> a -> a -> D.Doc
395−viewChange toString (Widths nameWidth leftWidth rightWidth) name old new =
395+viewChange toChars (Widths nameWidth leftWidth rightWidth) name old new =
396 D.hsep
396 D.hsep
397 [ viewName nameWidth name
397 [ viewName nameWidth name
398− , pad leftWidth (toString old)
398+ , pad leftWidth (toChars old)
399 , "=>"
399 , "=>"
400− , pad rightWidth (toString new)
400+ , pad rightWidth (toChars new)
401 ]
401 ]
402
402
403
403
404viewRemove :: (a -> String) -> Widths -> Pkg.Name -> a -> D.Doc
404viewRemove :: (a -> String) -> Widths -> Pkg.Name -> a -> D.Doc
405−viewRemove toString (Widths nameWidth leftWidth _) name old =
405+viewRemove toChars (Widths nameWidth leftWidth _) name old =
406− viewName nameWidth name <+> pad leftWidth (toString old)
406+ viewName nameWidth name <+> pad leftWidth (toChars old)
407
407
408
408
409viewName :: Int -> Pkg.Name -> D.Doc
409viewName :: Int -> Pkg.Name -> D.Doc
410viewName width name =
410viewName width name =
411− D.fill (width + 3) (D.fromText (Pkg.toText name))
411+ D.fill (width + 3) (D.fromUtf8 (Pkg.toString name))
412
412
413
413
414pad :: Int -> String -> D.Doc
414pad :: Int -> String -> D.Doc
415pad width string =
415pad width string =
416− D.fromString (replicate (width - length string) ' ') <> D.fromString string
416+ D.fromChars (replicate (width - length string) ' ') <> D.fromChars string
417
417
418
418
419
419
@@ -429,13 +429,13 @@ data Widths =
429
429
430
430
431widen :: (a -> String) -> Pkg.Name -> Change a -> Widths -> Widths
431widen :: (a -> String) -> Pkg.Name -> Change a -> Widths -> Widths
432−widen toString pkg change (Widths name left right) =
432+widen toChars pkg change (Widths name left right) =
433 let
433 let
434 toLength a =
434 toLength a =
435− length (toString a)
435+ length (toChars a)
436
436
437 newName =
437 newName =
438− max name (length (Pkg.toString pkg))
438+ max name (length (Pkg.toChars pkg))
439 in
439 in
440 case change of
440 case change of
441 Insert new ->
441 Insert new ->
builder/src/Reporting/Exit/Bump.hs+4−4
@@ -6,7 +6,7 @@ module Reporting.Exit.Bump
6 where
6 where
7
7
8
8
9−import qualified Elm.Package as Pkg
9+import qualified Elm.Version as V
10import Reporting.Doc ((<>))
10import Reporting.Doc ((<>))
11import qualified Reporting.Doc as D
11import qualified Reporting.Doc as D
12import qualified Reporting.Exit.Help as Help
12import qualified Reporting.Exit.Help as Help
@@ -18,7 +18,7 @@ import qualified Reporting.Exit.Help as Help
18
18
19data Exit
19data Exit
20 = Application
20 = Application
21− | Unbumpable Pkg.Version [Pkg.Version]
21+ | Unbumpable V.Version [V.Version]
22
22
23
23
24
24
@@ -38,7 +38,7 @@ toReport exit =
38 Help.docReport "UNBUMPABLE" (Just "elm.json")
38 Help.docReport "UNBUMPABLE" (Just "elm.json")
39 ( D.fillSep
39 ( D.fillSep
40 ["Your","elm.json","says","I","should","bump","relative","to","version"
40 ["Your","elm.json","says","I","should","bump","relative","to","version"
41− ,D.red (D.fromText (Pkg.versionToText vsn)) <> ","
41+ ,D.red (D.fromUtf8 (V.toString vsn)) <> ","
42 ,"but","I","cannot","find","that","version","on","<https://package.elm-lang.org>."
42 ,"but","I","cannot","find","that","version","on","<https://package.elm-lang.org>."
43 ,"That","means","there","is","no","API","for","me","to","diff","against","and"
43 ,"That","means","there","is","no","API","for","me","to","diff","against","and"
44 ,"figure","out","if","these","are","MAJOR,","MINOR,","or","PATCH","changes."
44 ,"figure","out","if","these","are","MAJOR,","MINOR,","or","PATCH","changes."
@@ -47,5 +47,5 @@ toReport exit =
47 [ D.fillSep $
47 [ D.fillSep $
48 ["Try","bumping","again","after","changing","the",D.dullyellow "\"version\"","in","elm.json"]
48 ["Try","bumping","again","after","changing","the",D.dullyellow "\"version\"","in","elm.json"]
49 ++ if length versions == 1 then ["to:"] else ["to","one","of","these:"]
49 ++ if length versions == 1 then ["to:"] else ["to","one","of","these:"]
50− , D.vcat $ map (D.green . D.fromText . Pkg.versionToText) versions
50+ , D.vcat $ map (D.green . D.fromUtf8 . V.toString) versions
51 ]
51 ]
builder/src/Reporting/Exit/Crawl.hs+31−32
@@ -9,15 +9,14 @@ module Reporting.Exit.Crawl
9 where
9 where
10
10
11
11
12−import qualified Data.ByteString as BS
13import qualified Data.Char as Char
12import qualified Data.Char as Char
14import qualified Data.Map as Map
13import qualified Data.Map as Map
15−import qualified Data.Text.Encoding as Text
16import qualified Data.Time.Clock as Time
14import qualified Data.Time.Clock as Time
17
15
18import qualified Elm.Compiler as Compiler
16import qualified Elm.Compiler as Compiler
19import qualified Elm.ModuleName as ModuleName
17import qualified Elm.ModuleName as ModuleName
20import qualified Elm.Package as Pkg
18import qualified Elm.Package as Pkg
19+import qualified Elm.Version as V
21import Reporting.Doc ((<+>), (<>))
20import Reporting.Doc ((<+>), (<>))
22import qualified Reporting.Doc as D
21import qualified Reporting.Doc as D
23import qualified Reporting.Exit.Compile as Compile
22import qualified Reporting.Exit.Compile as Compile
@@ -39,7 +38,7 @@ data Exit
39data Problem
38data Problem
40 = ModuleNotFound Origin ModuleName.Raw SrcDirs
39 = ModuleNotFound Origin ModuleName.Raw SrcDirs
41 | ModuleAmbiguous Origin ModuleName.Raw [FilePath] [Pkg.Canonical]
40 | ModuleAmbiguous Origin ModuleName.Raw [FilePath] [Pkg.Canonical]
42− | BadHeader FilePath Time.UTCTime BS.ByteString Compiler.Error
41+ | BadHeader FilePath Time.UTCTime String Compiler.Error
43 | ModuleNameReservedForKernel Origin ModuleName.Raw
42 | ModuleNameReservedForKernel Origin ModuleName.Raw
44 | ModuleNameMissing FilePath ModuleName.Raw
43 | ModuleNameMissing FilePath ModuleName.Raw
45 | ModuleNameMismatch
44 | ModuleNameMismatch
@@ -71,7 +70,7 @@ toReport exit =
71 RootFileNotFound path ->
70 RootFileNotFound path ->
72 Help.report "FILE NOT FOUND" Nothing
71 Help.report "FILE NOT FOUND" Nothing
73 "You want me to compile this file:"
72 "You want me to compile this file:"
74− [ D.indent 4 $ D.dullyellow $ D.fromString path
73+ [ D.indent 4 $ D.dullyellow $ D.fromChars path
75 , "I cannot find it though! Is there a typo?"
74 , "I cannot find it though! Is there a typo?"
76 ]
75 ]
77
76
@@ -79,10 +78,10 @@ toReport exit =
79 Help.report "DUPLICATE NAMES" Nothing
78 Help.report "DUPLICATE NAMES" Nothing
80 "I am trying to compile multiple modules with the same name:"
79 "I am trying to compile multiple modules with the same name:"
81 [ D.indent 4 $ D.dullyellow $ D.vcat $
80 [ D.indent 4 $ D.dullyellow $ D.vcat $
82− map D.fromString paths
81+ map D.fromChars paths
83 , D.fillSep $
82 , D.fillSep $
84 [ "These", "modules", if length paths == 2 then "both" else "all", "claim"
83 [ "These", "modules", if length paths == 2 then "both" else "all", "claim"
85− , "to", "be", "named", D.dullyellow (D.fromString (ModuleName.nameToString name)) <> "."
84+ , "to", "be", "named", D.dullyellow (D.fromChars (ModuleName.nameToChars name)) <> "."
86 , "Change", "them", "to", "have", "unique", "names", "and", "you"
85 , "Change", "them", "to", "have", "unique", "names", "and", "you"
87 , "should", "be", "all", "set!"
86 , "should", "be", "all", "set!"
88 ]
87 ]
@@ -103,7 +102,7 @@ toReport exit =
103 BadKernelHeader filePath ->
102 BadKernelHeader filePath ->
104 Help.report "BAD KERNEL HEADER" Nothing
103 Help.report "BAD KERNEL HEADER" Nothing
105 "I ran into a bad header in this file:"
104 "I ran into a bad header in this file:"
106− [ D.indent 4 $ D.dullyellow $ D.fromString filePath
105+ [ D.indent 4 $ D.dullyellow $ D.fromChars filePath
107 , D.reflow $
106 , D.reflow $
108 "NOTE: Kernel code is only available to core Elm libraries to ensure\
107 "NOTE: Kernel code is only available to core Elm libraries to ensure\
109 \ the portability and security of the Elm ecosystem. This restriction\
108 \ the portability and security of the Elm ecosystem. This restriction\
@@ -128,7 +127,7 @@ problemToReport problem =
128 BadHeader path time source compilerError ->
127 BadHeader path time source compilerError ->
129 let
128 let
130 compilerExit =
129 compilerExit =
131− Compile.Exit "???" path time (Text.decodeUtf8 source) [compilerError]
130+ Compile.Exit "???" path time source [compilerError]
132 in
131 in
133 Help.compilerReport compilerExit []
132 Help.compilerReport compilerExit []
134
133
@@ -139,9 +138,9 @@ problemToReport problem =
139 Help.report "MODULE NAME MISMATCH" (Just path)
138 Help.report "MODULE NAME MISMATCH" (Just path)
140 ( "The file at " ++ path ++ " has a typo in the module name. It says:"
139 ( "The file at " ++ path ++ " has a typo in the module name. It says:"
141 )
140 )
142− [ D.indent 4 $ D.dullyellow $ "module" <+> D.red (D.fromString (ModuleName.nameToString actual)) <+> "exposing (..)"
141+ [ D.indent 4 $ D.dullyellow $ "module" <+> D.red (D.fromChars (ModuleName.nameToChars actual)) <+> "exposing (..)"
143 , "Looks like a typo or copy/paste error. Instead it needs to say:"
142 , "Looks like a typo or copy/paste error. Instead it needs to say:"
144− , D.indent 4 $ D.dullyellow $ "module" <+> D.green (D.fromString (ModuleName.nameToString expected)) <+> "exposing (..)"
143+ , D.indent 4 $ D.dullyellow $ "module" <+> D.green (D.fromChars (ModuleName.nameToChars expected)) <+> "exposing (..)"
145 , "Make the change and you should be all set!"
144 , "Make the change and you should be all set!"
146 ]
145 ]
147
146
@@ -167,9 +166,9 @@ badTagToDoc path name tag hintName summary =
167 summary
166 summary
168 [ D.fillSep $
167 [ D.fillSep $
169 [ "Get", "rid", "of", "all", "the"
168 [ "Get", "rid", "of", "all", "the"
170− , D.red (D.fromString tag)
169+ , D.red (D.fromChars tag)
171 , "stuff", "in"
170 , "stuff", "in"
172− , D.dullyellow (D.fromString (ModuleName.nameToString name))
171+ , D.dullyellow (D.fromChars (ModuleName.nameToChars name))
173 , "to", "proceed."
172 , "to", "proceed."
174 ]
173 ]
175 , D.toSimpleNote $
174 , D.toSimpleNote $
@@ -185,11 +184,11 @@ badTagToDoc path name tag hintName summary =
185namelessToDoc :: FilePath -> ModuleName.Raw -> Help.Report
184namelessToDoc :: FilePath -> ModuleName.Raw -> Help.Report
186namelessToDoc path name =
185namelessToDoc path name =
187 Help.report "UNNAMED MODULE" (Just path)
186 Help.report "UNNAMED MODULE" (Just path)
188− ( "The `" ++ ModuleName.nameToString name
187+ ( "The `" ++ ModuleName.nameToChars name
189 ++ "` module must start with a line like this:"
188 ++ "` module must start with a line like this:"
190 )
189 )
191− [ D.indent 4 $ D.dullyellow $ D.fromString $
190+ [ D.indent 4 $ D.dullyellow $ D.fromChars $
192− "module " ++ ModuleName.nameToString name ++ " exposing (..)"
191+ "module " ++ ModuleName.nameToChars name ++ " exposing (..)"
193 , D.reflow $
192 , D.reflow $
194 "Try adding that as the first line of your file!"
193 "Try adding that as the first line of your file!"
195 , D.toSimpleNote $
194 , D.toSimpleNote $
@@ -210,19 +209,19 @@ notFoundToDoc origin child srcDirs =
210 ElmJson ->
209 ElmJson ->
211 Help.report "MODULE NOT FOUND" (Just "elm.json")
210 Help.report "MODULE NOT FOUND" (Just "elm.json")
212 "Your elm.json says your project has the following module:"
211 "Your elm.json says your project has the following module:"
213− [ D.indent 4 $ D.red $ D.fromString $ ModuleName.nameToString child
212+ [ D.indent 4 $ D.red $ D.fromChars $ ModuleName.nameToChars child
214 , D.reflow $
213 , D.reflow $
215 "When creating packages, all modules must live in the src/ directory."
214 "When creating packages, all modules must live in the src/ directory."
216 ]
215 ]
217
216
218 File path ->
217 File path ->
219 Help.report "UNKNOWN IMPORT" (Just path)
218 Help.report "UNKNOWN IMPORT" (Just path)
220− ("I cannot find a `" ++ ModuleName.nameToString child ++ "` module to import.")
219+ ("I cannot find a `" ++ ModuleName.nameToChars child ++ "` module to import.")
221 (notFoundDetails child srcDirs)
220 (notFoundDetails child srcDirs)
222
221
223 Module path parent ->
222 Module path parent ->
224 Help.report "UNKNOWN IMPORT" (Just path)
223 Help.report "UNKNOWN IMPORT" (Just path)
225− ("The " ++ ModuleName.nameToString parent ++ " module has a bad import:")
224+ ("The " ++ ModuleName.nameToChars parent ++ " module has a bad import:")
226 (notFoundDetails child srcDirs)
225 (notFoundDetails child srcDirs)
227
226
228
227
@@ -230,26 +229,26 @@ notFoundDetails :: ModuleName.Raw -> SrcDirs -> [D.Doc]
230notFoundDetails child srcDirs =
229notFoundDetails child srcDirs =
231 let
230 let
232 simulatedCode =
231 simulatedCode =
233− D.indent 4 $ D.red $ D.fromString $ "import " ++ ModuleName.nameToString child
232+ D.indent 4 $ D.red $ D.fromChars $ "import " ++ ModuleName.nameToChars child
234 in
233 in
235 case Map.lookup child Pkg.suggestions of
234 case Map.lookup child Pkg.suggestions of
236 Just pkg ->
235 Just pkg ->
237 [ simulatedCode
236 [ simulatedCode
238 , D.reflow $
237 , D.reflow $
239− "Do you want the one from the " ++ Pkg.toString pkg
238+ "Do you want the one from the " ++ Pkg.toChars pkg
240 ++ " package? If so, run this command to add that dependency to your elm.json file:"
239 ++ " package? If so, run this command to add that dependency to your elm.json file:"
241− , D.indent 4 $ D.green $ D.fromString $ "elm install " ++ Pkg.toString pkg
240+ , D.indent 4 $ D.green $ D.fromChars $ "elm install " ++ Pkg.toChars pkg
242 , case srcDirs of
241 , case srcDirs of
243 Pkg ->
242 Pkg ->
244 D.reflow $
243 D.reflow $
245 "If you want a local file, make sure the `"
244 "If you want a local file, make sure the `"
246− ++ ModuleName.nameToString child
245+ ++ ModuleName.nameToChars child
247 ++ "` module is in your src/ directory."
246 ++ "` module is in your src/ directory."
248
247
249 App _ ->
248 App _ ->
250 D.reflow $
249 D.reflow $
251 "If you want a local file, make sure the `"
250 "If you want a local file, make sure the `"
252− ++ ModuleName.nameToString child
251+ ++ ModuleName.nameToChars child
253 ++ "` module is in one of the \"source-directories\" listed in your elm.json file."
252 ++ "` module is in one of the \"source-directories\" listed in your elm.json file."
254 ]
253 ]
255
254
@@ -279,15 +278,15 @@ ambiguousToDoc :: Origin -> ModuleName.Raw -> [FilePath] -> [Pkg.Canonical] -> H
279ambiguousToDoc origin child paths pkgs =
278ambiguousToDoc origin child paths pkgs =
280 let
279 let
281 pkgToString (Pkg.Canonical pkg vsn) =
280 pkgToString (Pkg.Canonical pkg vsn) =
282− "exposed by " ++ Pkg.toString pkg ++ " " ++ Pkg.versionToString vsn
281+ "exposed by " ++ Pkg.toChars pkg ++ " " ++ V.toChars vsn
283
282
284 makeReport maybePath summary yellowString =
283 makeReport maybePath summary yellowString =
285 Help.report "AMBIGUOUS IMPORT" maybePath summary
284 Help.report "AMBIGUOUS IMPORT" maybePath summary
286− [ D.indent 4 $ D.dullyellow $ D.fromString yellowString
285+ [ D.indent 4 $ D.dullyellow $ D.fromChars yellowString
287 , D.reflow $
286 , D.reflow $
288 "I found multiple module with that name though:"
287 "I found multiple module with that name though:"
289 , D.indent 4 $ D.dullyellow $ D.vcat $
288 , D.indent 4 $ D.dullyellow $ D.vcat $
290− map D.fromString $ paths ++ map pkgToString pkgs
289+ map D.fromChars $ paths ++ map pkgToString pkgs
291 , D.reflow $
290 , D.reflow $
292 if null paths then
291 if null paths then
293 "It looks like the name clash is in your dependencies, which is\
292 "It looks like the name clash is in your dependencies, which is\
@@ -303,19 +302,19 @@ ambiguousToDoc origin child paths pkgs =
303 makeReport
302 makeReport
304 Nothing
303 Nothing
305 "Your elm.json wants the following module:"
304 "Your elm.json wants the following module:"
306− (ModuleName.nameToString child)
305+ (ModuleName.nameToChars child)
307
306
308 File path ->
307 File path ->
309 makeReport
308 makeReport
310 (Just path)
309 (Just path)
311 ("The file at " ++ path ++ " has an ambiguous import:")
310 ("The file at " ++ path ++ " has an ambiguous import:")
312− ("import " ++ ModuleName.nameToString child)
311+ ("import " ++ ModuleName.nameToChars child)
313
312
314 Module path parent ->
313 Module path parent ->
315 makeReport
314 makeReport
316 (Just path)
315 (Just path)
317− ("The " ++ ModuleName.nameToString parent ++ " module has an ambiguous import:")
316+ ("The " ++ ModuleName.nameToChars parent ++ " module has an ambiguous import:")
318− ("import " ++ ModuleName.nameToString child)
317+ ("import " ++ ModuleName.nameToChars child)
319
318
320
319
321kernelNameToDoc :: Origin -> ModuleName.Raw -> Help.Report
320kernelNameToDoc :: Origin -> ModuleName.Raw -> Help.Report
@@ -335,11 +334,11 @@ kernelNameToDoc origin kernelName =
335
334
336 Module path parent ->
335 Module path parent ->
337 ( Just path
336 ( Just path
338− , "Your " ++ ModuleName.nameToString parent ++ " module is trying to import:"
337+ , "Your " ++ ModuleName.nameToChars parent ++ " module is trying to import:"
339 )
338 )
340 in
339 in
341 Help.report "BAD MODULE NAME" maybePath statement
340 Help.report "BAD MODULE NAME" maybePath statement
342− [ D.indent 4 $ D.dullyellow $ D.fromString $ ModuleName.nameToString kernelName
341+ [ D.indent 4 $ D.dullyellow $ D.fromChars $ ModuleName.nameToChars kernelName
343 , D.reflow $
342 , D.reflow $
344 "But names like that are reserved for internal use.\
343 "But names like that are reserved for internal use.\
345 \ Switch to a name outside of the Elm/Kernel/ namespace."
344 \ Switch to a name outside of the Elm/Kernel/ namespace."
builder/src/Reporting/Exit/Deps.hs+16−16
@@ -6,9 +6,9 @@ module Reporting.Exit.Deps
6 where
6 where
7
7
8
8
9−import qualified Elm.Compiler as Compiler
9+import qualified Elm.Constraint as Con
10import qualified Elm.Package as Pkg
10import qualified Elm.Package as Pkg
11−import qualified Elm.Project.Constraint as Con
11+import qualified Elm.Version as V
12import Reporting.Doc ((<>))
12import Reporting.Doc ((<>))
13import qualified Reporting.Doc as D
13import qualified Reporting.Doc as D
14import qualified Reporting.Exit.Help as Help
14import qualified Reporting.Exit.Help as Help
@@ -23,10 +23,10 @@ data Exit
23 | PackageNotFound Pkg.Name [Pkg.Name]
23 | PackageNotFound Pkg.Name [Pkg.Name]
24 -- verify
24 -- verify
25 | PkgBadElm Con.Constraint
25 | PkgBadElm Con.Constraint
26− | AppBadElm Pkg.Version
26+ | AppBadElm V.Version
27− | AppMissingTrans [(Pkg.Name, Pkg.Version)]
27+ | AppMissingTrans [(Pkg.Name, V.Version)]
28 | BadDeps
28 | BadDeps
29− | BuildFailure FilePath Pkg.Name Pkg.Version
29+ | BuildFailure FilePath Pkg.Name V.Version
30
30
31
31
32
32
@@ -40,7 +40,7 @@ toReport exit =
40 Help.report "CORRUPT CACHE" Nothing
40 Help.report "CORRUPT CACHE" Nothing
41 ( "I ran into an unknown package while exploring dependencies:"
41 ( "I ran into an unknown package while exploring dependencies:"
42 )
42 )
43− [ D.indent 4 $ D.dullyellow $ D.fromString $ Pkg.toString pkg
43+ [ D.indent 4 $ D.dullyellow $ D.fromUtf8 $ Pkg.toString pkg
44 , D.reflow $
44 , D.reflow $
45 "This suggests that your " ++ elmHome ++ " directory has been corrupted.\
45 "This suggests that your " ++ elmHome ++ " directory has been corrupted.\
46 \ Maybe some program is messing with it? It is just cached files,\
46 \ Maybe some program is messing with it? It is just cached files,\
@@ -51,22 +51,22 @@ toReport exit =
51 Help.docReport "PACKAGE NOT FOUND" Nothing
51 Help.docReport "PACKAGE NOT FOUND" Nothing
52 ( D.fillSep
52 ( D.fillSep
53 ["I","cannot","find","a"
53 ["I","cannot","find","a"
54− ,D.red (D.fromString (Pkg.toString package))
54+ ,D.red (D.fromUtf8 (Pkg.toString package))
55 ,"package","on","the","package","website."
55 ,"package","on","the","package","website."
56 ]
56 ]
57 )
57 )
58 [ "Maybe you want one of these instead?"
58 [ "Maybe you want one of these instead?"
59− , D.indent 4 $ D.dullyellow $ D.vcat $ map (D.fromString . Pkg.toString) suggestions
59+ , D.indent 4 $ D.dullyellow $ D.vcat $ map (D.fromUtf8 . Pkg.toString) suggestions
60 , "But check <https://package.elm-lang.org> to see all possibilities!"
60 , "But check <https://package.elm-lang.org> to see all possibilities!"
61 ]
61 ]
62
62
63 PkgBadElm constraint ->
63 PkgBadElm constraint ->
64 Help.report "ELM VERSION MISMATCH" (Just "elm.json")
64 Help.report "ELM VERSION MISMATCH" (Just "elm.json")
65 "Your elm.json says this package needs a version of Elm in this range:"
65 "Your elm.json says this package needs a version of Elm in this range:"
66− [ D.indent 4 $ D.dullyellow $ D.fromString $ Con.toString constraint
66+ [ D.indent 4 $ D.dullyellow $ D.fromUtf8 $ Con.toString constraint
67 , D.fillSep
67 , D.fillSep
68 [ "But", "you", "are", "using", "Elm"
68 [ "But", "you", "are", "using", "Elm"
69− , D.red (D.fromString (Pkg.versionToString Compiler.version))
69+ , D.red (D.fromUtf8 (V.toString V.compiler))
70 , "right", "now."
70 , "right", "now."
71 ]
71 ]
72 ]
72 ]
@@ -76,9 +76,9 @@ toReport exit =
76 "Your elm.json says this application needs a different version of Elm."
76 "Your elm.json says this application needs a different version of Elm."
77 [ D.fillSep
77 [ D.fillSep
78 [ "It", "requires"
78 [ "It", "requires"
79− , D.green (D.fromString (Pkg.versionToString version)) <> ","
79+ , D.green (D.fromUtf8 (V.toString version)) <> ","
80 , "but", "you", "are", "using"
80 , "but", "you", "are", "using"
81− , D.red (D.fromString (Pkg.versionToString Compiler.version))
81+ , D.red (D.fromUtf8 (V.toString V.compiler))
82 , "right", "now."
82 , "right", "now."
83 ]
83 ]
84 ]
84 ]
@@ -86,11 +86,11 @@ toReport exit =
86 AppMissingTrans missingDeps ->
86 AppMissingTrans missingDeps ->
87 let
87 let
88 toEntry (pkg, vsn) =
88 toEntry (pkg, vsn) =
89− "\"" ++ Pkg.toString pkg ++ "\": \"" ++ Pkg.versionToString vsn ++ "\""
89+ "\"" ++ Pkg.toChars pkg ++ "\": \"" ++ V.toChars vsn ++ "\""
90 in
90 in
91 Help.report "MISSING DEPENDENCIES" (Just "elm.json")
91 Help.report "MISSING DEPENDENCIES" (Just "elm.json")
92 "Your elm.json is missing some \"indirect\" dependencies:"
92 "Your elm.json is missing some \"indirect\" dependencies:"
93− [ D.indent 4 $ D.dullyellow $ D.vcat $ map (D.fromString . toEntry) missingDeps
93+ [ D.indent 4 $ D.dullyellow $ D.vcat $ map (D.fromChars . toEntry) missingDeps
94 , D.fillSep
94 , D.fillSep
95 ["This","usually","means","you","are","editing","elm.json","by","hand."
95 ["This","usually","means","you","are","editing","elm.json","by","hand."
96 ,"It","is","much","more","reliable","to","use","the"
96 ,"It","is","much","more","reliable","to","use","the"
@@ -114,10 +114,10 @@ toReport exit =
114 BuildFailure elmHome pkg vsn ->
114 BuildFailure elmHome pkg vsn ->
115 Help.report "CORRUPT DEPENDENCY" Nothing
115 Help.report "CORRUPT DEPENDENCY" Nothing
116 "I ran into a problem while building the following package:"
116 "I ran into a problem while building the following package:"
117− [ D.indent 4 $ D.red $ D.fromString $ Pkg.toString pkg ++ " " ++ Pkg.versionToString vsn
117+ [ D.indent 4 $ D.red $ D.fromChars $ Pkg.toChars pkg ++ " " ++ V.toChars vsn
118 , D.fillSep
118 , D.fillSep
119 ["This","probably","means","the","downloaded","files","got","corrupted","somehow."
119 ["This","probably","means","the","downloaded","files","got","corrupted","somehow."
120− ,"Try","deleting",D.dullyellow (D.fromString elmHome),"(a","directory","for"
120+ ,"Try","deleting",D.dullyellow (D.fromChars elmHome),"(a","directory","for"
121 ,"caching","build","artifacts)","and","see","if","that","resolves","the","issue."
121 ,"caching","build","artifacts)","and","see","if","that","resolves","the","issue."
122 ]
122 ]
123 ]
123 ]
builder/src/Reporting/Exit/Diff.hs+7−6
@@ -9,6 +9,7 @@ module Reporting.Exit.Diff
9import qualified Data.List as List
9import qualified Data.List as List
10
10
11import qualified Elm.Package as Pkg
11import qualified Elm.Package as Pkg
12+import qualified Elm.Version as V
12import qualified Reporting.Doc as D
13import qualified Reporting.Doc as D
13import qualified Reporting.Exit.Help as Help
14import qualified Reporting.Exit.Help as Help
14
15
@@ -21,7 +22,7 @@ data Exit
21 = Application
22 = Application
22 | Unpublished
23 | Unpublished
23 | UnknownPackage Pkg.Name [Pkg.Name]
24 | UnknownPackage Pkg.Name [Pkg.Name]
24− | UnknownVersion Pkg.Name Pkg.Version [Pkg.Version]
25+ | UnknownVersion Pkg.Name V.Version [V.Version]
25
26
26
27
27
28
@@ -47,16 +48,16 @@ toReport exit =
47 Help.report "UNKNOWN PACKAGE" Nothing
48 Help.report "UNKNOWN PACKAGE" Nothing
48 ( "I cannot find a package called:"
49 ( "I cannot find a package called:"
49 )
50 )
50− [ D.indent 4 $ D.red $ D.fromText $ Pkg.toText pkg
51+ [ D.indent 4 $ D.red $ D.fromUtf8 $ Pkg.toString pkg
51 , "Maybe you want one of these instead?"
52 , "Maybe you want one of these instead?"
52− , D.indent 4 $ D.dullyellow $ D.vcat $ map (D.fromText . Pkg.toText) suggestions
53+ , D.indent 4 $ D.dullyellow $ D.vcat $ map (D.fromUtf8 . Pkg.toString) suggestions
53 , "But check <https://package.elm-lang.org> to see all possibilities!"
54 , "But check <https://package.elm-lang.org> to see all possibilities!"
54 ]
55 ]
55
56
56 UnknownVersion _pkg vsn realVersions ->
57 UnknownVersion _pkg vsn realVersions ->
57 Help.docReport "UNKNOWN VERSION" Nothing
58 Help.docReport "UNKNOWN VERSION" Nothing
58 ( D.fillSep $
59 ( D.fillSep $
59− [ "Version", D.red (D.fromText (Pkg.versionToText vsn))
60+ [ "Version", D.red (D.fromUtf8 (V.toString vsn))
60 , "has", "never", "been", "published,", "so", "I"
61 , "has", "never", "been", "published,", "so", "I"
61 , "cannot", "diff", "against", "it."
62 , "cannot", "diff", "against", "it."
62 ]
63 ]
@@ -64,8 +65,8 @@ toReport exit =
64 [ "Here are all the versions that HAVE been published:"
65 [ "Here are all the versions that HAVE been published:"
65 , D.indent 4 $ D.dullyellow $ D.vcat $
66 , D.indent 4 $ D.dullyellow $ D.vcat $
66 let
67 let
67− sameMajor v1 v2 = Pkg._major v1 == Pkg._major v2
68+ sameMajor v1 v2 = V._major v1 == V._major v2
68− mkRow vsns = D.hsep $ map (D.fromText . Pkg.versionToText) vsns
69+ mkRow vsns = D.hsep $ map (D.fromUtf8 . V.toString) vsns
69 in
70 in
70 map mkRow $ List.groupBy sameMajor (List.sort realVersions)
71 map mkRow $ List.groupBy sameMajor (List.sort realVersions)
71 , "Want one of those instead?"
72 , "Want one of those instead?"
builder/src/Reporting/Exit/Help.hs+13−12
@@ -14,11 +14,12 @@ module Reporting.Exit.Help
14 where
14 where
15
15
16
16
17−import qualified Data.Text as Text
17+import qualified Data.Utf8 as Utf8
18import GHC.IO.Handle (hIsTerminalDevice)
18import GHC.IO.Handle (hIsTerminalDevice)
19import System.IO (Handle, hPutStr, stderr, stdout)
19import System.IO (Handle, hPutStr, stderr, stdout)
20
20
21−import qualified Json.Encode as Encode
21+import qualified Json.Encode as E
22+import Json.Encode ((==>))
22import Reporting.Doc ((<+>))
23import Reporting.Doc ((<+>))
23import qualified Reporting.Doc as D
24import qualified Reporting.Doc as D
24import qualified Reporting.Exit.Compile as Compile
25import qualified Reporting.Exit.Compile as Compile
@@ -82,7 +83,7 @@ reportToDoc report_ =
82
83
83 errorBar =
84 errorBar =
84 D.dullcyan $
85 D.dullcyan $
85− "--" <+> D.fromString title <+> D.fromString errorBarEnd
86+ "--" <+> D.fromChars title <+> D.fromChars errorBarEnd
86 in
87 in
87 D.stack [errorBar, message, ""]
88 D.stack [errorBar, message, ""]
88
89
@@ -91,21 +92,21 @@ reportToDoc report_ =
91-- TO JSON
92-- TO JSON
92
93
93
94
94−reportToJson :: Report -> Encode.Value
95+reportToJson :: Report -> E.Value
95reportToJson report_ =
96reportToJson report_ =
96 case report_ of
97 case report_ of
97 CompilerReport e es ->
98 CompilerReport e es ->
98− Encode.object
99+ E.object
99− [ ("type", Encode.text "compile-errors")
100+ [ "type" ==> E.string "compile-errors"
100− , ("errors", Encode.list Compile.toJson (e:es))
101+ , "errors" ==> E.list Compile.toJson (e:es)
101 ]
102 ]
102
103
103 Report title maybePath message ->
104 Report title maybePath message ->
104− Encode.object
105+ E.object
105− [ ("type", Encode.text "error")
106+ [ "type" ==> E.string "error"
106− , ("path", maybe Encode.null (Encode.text . Text.pack) maybePath)
107+ , "path" ==> maybe E.null (E.string . Utf8.fromChars) maybePath
107− , ("title", Encode.text (Text.pack title))
108+ , "title" ==> E.string (Utf8.fromChars title)
108− , ("message", D.encode message)
109+ , "message" ==> D.encode message
109 ]
110 ]
110
111
111
112
builder/src/Reporting/Exit/Init.hs+3−4
@@ -6,11 +6,10 @@ module Reporting.Exit.Init
6 where
6 where
7
7
8
8
9+import qualified Elm.Package as Pkg
9import qualified Reporting.Doc as D
10import qualified Reporting.Doc as D
10import qualified Reporting.Exit.Help as Help
11import qualified Reporting.Exit.Help as Help
11
12
12−import qualified Elm.Package as Pkg
13−
14
13
15
14
16-- EXITS
15-- EXITS
@@ -32,7 +31,7 @@ toReport exit =
32 Help.report "NO SOLUTION" Nothing
31 Help.report "NO SOLUTION" Nothing
33 "I tried to create an elm.json with the following direct dependencies:"
32 "I tried to create an elm.json with the following direct dependencies:"
34 [ D.indent 4 $ D.vcat $
33 [ D.indent 4 $ D.vcat $
35− map (D.dullyellow . D.fromString . Pkg.toString) pkgs
34+ map (D.dullyellow . D.fromChars . Pkg.toChars) pkgs
36 , D.reflow $
35 , D.reflow $
37 "I could not find compatible versions though! This should not happen, so please\
36 "I could not find compatible versions though! This should not happen, so please\
38 \ ask around one of the community forums <http://elm-lang.org/community> to learn\
37 \ ask around one of the community forums <http://elm-lang.org/community> to learn\
@@ -43,7 +42,7 @@ toReport exit =
43 Help.report "EXISTING PROJECT" Nothing
42 Help.report "EXISTING PROJECT" Nothing
44 "You already have an elm.json file, so there is nothing for me to initialize!"
43 "You already have an elm.json file, so there is nothing for me to initialize!"
45 [ D.fillSep
44 [ D.fillSep
46− ["Maybe",D.green (D.fromString (D.makeLink "init")),"can","help"
45+ ["Maybe",D.green (D.fromChars (D.makeLink "init")),"can","help"
47 ,"you","figure","out","what","to","do","next?"
46 ,"you","figure","out","what","to","do","next?"
48 ]
47 ]
49 ]
48 ]
builder/src/Reporting/Exit/Install.hs+4−4
@@ -6,8 +6,8 @@ module Reporting.Exit.Install
6 where
6 where
7
7
8
8
9−import qualified Elm.Compiler as Compiler
10import qualified Elm.Package as Pkg
9import qualified Elm.Package as Pkg
10+import qualified Elm.Version as V
11import qualified Reporting.Doc as D
11import qualified Reporting.Doc as D
12import qualified Reporting.Exit.Help as Help
12import qualified Reporting.Exit.Help as Help
13
13
@@ -40,7 +40,7 @@ toReport exit =
40 ["In","JavaScript","folks","run","`npm install`","to","start","projects."
40 ["In","JavaScript","folks","run","`npm install`","to","start","projects."
41 ,"\"Gotta","download","everything!\"","But","why","download","packages"
41 ,"\"Gotta","download","everything!\"","But","why","download","packages"
42 ,"again","and","again?","Instead,","Elm","caches","packages","in"
42 ,"again","and","again?","Instead,","Elm","caches","packages","in"
43− ,D.dullyellow (D.fromString elmHome)
43+ ,D.dullyellow (D.fromChars elmHome)
44 ,"so","each","one","is","downloaded","and","built","ONCE","on","your","machine."
44 ,"so","each","one","is","downloaded","and","built","ONCE","on","your","machine."
45 ,"Elm","projects","check","that","cache","before","trying","the","internet."
45 ,"Elm","projects","check","that","cache","before","trying","the","internet."
46 ,"This","reduces","build","times,","reduces","server","costs,","and","makes","it"
46 ,"This","reduces","build","times,","reduces","server","costs,","and","makes","it"
@@ -65,9 +65,9 @@ toReport exit =
65
65
66 _:_ ->
66 _:_ ->
67 Help.report "OLD DEPENDENCIES" (Just "elm.json")
67 Help.report "OLD DEPENDENCIES" (Just "elm.json")
68− ( "The following packages do not work with Elm " ++ Pkg.versionToString Compiler.version ++ " right now:"
68+ ( "The following packages do not work with Elm " ++ V.toChars V.compiler ++ " right now:"
69 )
69 )
70− [ D.indent 4 $ D.vcat $ map (D.red . D.fromString . Pkg.toString) badPackages
70+ [ D.indent 4 $ D.vcat $ map (D.red . D.fromUtf8 . Pkg.toString) badPackages
71 , D.reflow $
71 , D.reflow $
72 "This may be because it is not upgraded yet. It may be because a\
72 "This may be because it is not upgraded yet. It may be because a\
73 \ better solution came along, so there was no need to upgrade it.\
73 \ better solution came along, so there was no need to upgrade it.\
builder/src/Reporting/Exit/Make.hs+1−1
@@ -42,7 +42,7 @@ toReport exit =
42 CannotOptimizeDebugValues m ms ->
42 CannotOptimizeDebugValues m ms ->
43 Help.report "DEBUG REMNANTS" Nothing
43 Help.report "DEBUG REMNANTS" Nothing
44 "There are uses of the `Debug` module in the following modules:"
44 "There are uses of the `Debug` module in the following modules:"
45− [ D.indent 4 $ D.red $ D.vcat $ map (D.fromString . ModuleName.nameToString) (m:ms)
45+ [ D.indent 4 $ D.red $ D.vcat $ map (D.fromChars . ModuleName.nameToChars) (m:ms)
46 , D.reflow "But the --optimize flag only works if all `Debug` functions are removed!"
46 , D.reflow "But the --optimize flag only works if all `Debug` functions are removed!"
47 , D.toSimpleNote $
47 , D.toSimpleNote $
48 "The issue is that --optimize strips out info needed by `Debug` functions.\
48 "The issue is that --optimize strips out info needed by `Debug` functions.\
builder/src/Reporting/Exit/Publish.hs+22−22
@@ -7,7 +7,7 @@ module Reporting.Exit.Publish
7
7
8
8
9import Deps.Diff (Magnitude, magnitudeToString)
9import Deps.Diff (Magnitude, magnitudeToString)
10−import qualified Elm.Package as Pkg
10+import qualified Elm.Version as V
11import Reporting.Doc ((<>))
11import Reporting.Doc ((<>))
12import qualified Reporting.Doc as D
12import qualified Reporting.Doc as D
13import qualified Reporting.Exit.Help as Help
13import qualified Reporting.Exit.Help as Help
@@ -19,18 +19,18 @@ import qualified Reporting.Exit.Help as Help
19
19
20data Exit
20data Exit
21 = Application
21 = Application
22− | NotInitialVersion Pkg.Version
22+ | NotInitialVersion V.Version
23− | AlreadyPublished Pkg.Version
23+ | AlreadyPublished V.Version
24− | InvalidBump Pkg.Version Pkg.Version
24+ | InvalidBump V.Version V.Version
25− | BadBump Pkg.Version Pkg.Version Magnitude Pkg.Version Magnitude
25+ | BadBump V.Version V.Version Magnitude V.Version Magnitude
26 | NoSummary
26 | NoSummary
27 | NoExposed
27 | NoExposed
28 | NoReadme
28 | NoReadme
29 | ShortReadme
29 | ShortReadme
30 | NoLicense
30 | NoLicense
31− | MissingTag Pkg.Version
31+ | MissingTag V.Version
32 | NoGit
32 | NoGit
33− | LocalChanges Pkg.Version
33+ | LocalChanges V.Version
34
34
35
35
36
36
@@ -47,7 +47,7 @@ toReport exit =
47 Help.docReport "INVALID VERSION" Nothing
47 Help.docReport "INVALID VERSION" Nothing
48 ( D.fillSep
48 ( D.fillSep
49 ["I","cannot","publish"
49 ["I","cannot","publish"
50− ,D.red (D.fromString (Pkg.versionToString vsn))
50+ ,D.red (D.fromUtf8 (V.toString vsn))
51 ,"as","the","initial","version."
51 ,"as","the","initial","version."
52 ]
52 ]
53 )
53 )
@@ -61,7 +61,7 @@ toReport exit =
61 Help.docReport "ALREADY PUBLISHED" Nothing
61 Help.docReport "ALREADY PUBLISHED" Nothing
62 ( D.vcat
62 ( D.vcat
63 [ D.fillSep
63 [ D.fillSep
64− [ "Version", D.green (D.fromString (Pkg.versionToString vsn))
64+ [ "Version", D.green (D.fromUtf8 (V.toString vsn))
65 , "has", "already", "been", "published.", "You", "cannot"
65 , "has", "already", "been", "published.", "You", "cannot"
66 , "publish", "it", "again!"
66 , "publish", "it", "again!"
67 ]
67 ]
@@ -78,14 +78,14 @@ toReport exit =
78 Help.docReport "INVALID VERSION" (Just "elm.json")
78 Help.docReport "INVALID VERSION" (Just "elm.json")
79 ( D.fillSep $
79 ( D.fillSep $
80 ["Your","elm.json","says","the","next","version","should","be"
80 ["Your","elm.json","says","the","next","version","should","be"
81− ,D.red (D.fromString (Pkg.versionToString statedVersion)) <> ","
81+ ,D.red (D.fromUtf8 (V.toString statedVersion)) <> ","
82 ,"but","that","is","not","valid","based","on","the","previously"
82 ,"but","that","is","not","valid","based","on","the","previously"
83 ,"published","versions."
83 ,"published","versions."
84 ]
84 ]
85 )
85 )
86 [ D.fillSep $
86 [ D.fillSep $
87 ["Change","the","version","back","to"
87 ["Change","the","version","back","to"
88− ,D.green (D.fromString (Pkg.versionToString latestVersion))
88+ ,D.green (D.fromUtf8 (V.toString latestVersion))
89 ,"which","is","the","most","recently","published","version."
89 ,"which","is","the","most","recently","published","version."
90 ,"From","there,","have","Elm","bump","the","version","by","running:"
90 ,"From","there,","have","Elm","bump","the","version","by","running:"
91 ]
91 ]
@@ -100,20 +100,20 @@ toReport exit =
100 (
100 (
101 D.fillSep $
101 D.fillSep $
102 ["Your","elm.json","says","the","next","version","should","be"
102 ["Your","elm.json","says","the","next","version","should","be"
103− ,D.red (D.fromString (Pkg.versionToString new)) <> ","
103+ ,D.red (D.fromUtf8 (V.toString new)) <> ","
104− ,"indicating","a",D.fromString (magnitudeToString magnitude)
104+ ,"indicating","a",D.fromChars (magnitudeToString magnitude)
105 ,"change","to","the","public","API."
105 ,"change","to","the","public","API."
106 ,"This","does","not","match","the","API","diff","given","by:"
106 ,"This","does","not","match","the","API","diff","given","by:"
107 ]
107 ]
108 )
108 )
109− [ D.indent 4 $ D.fromString $
109+ [ D.indent 4 $ D.fromChars $
110− "elm diff " ++ Pkg.versionToString old
110+ "elm diff " ++ V.toChars old
111
111
112 , D.fillSep $
112 , D.fillSep $
113 ["This","command","says","this","is","a"
113 ["This","command","says","this","is","a"
114− ,D.fromString (magnitudeToString realMagnitude)
114+ ,D.fromChars (magnitudeToString realMagnitude)
115 ,"change,","so","the","next","version","should","be"
115 ,"change,","so","the","next","version","should","be"
116− ,D.green (D.fromString (Pkg.versionToString realNew)) <> "."
116+ ,D.green (D.fromUtf8 (V.toString realNew)) <> "."
117 ,"Double","check","everything","to","make","sure","you"
117 ,"Double","check","everything","to","make","sure","you"
118 ,"are","publishing","what","you","want!"
118 ,"are","publishing","what","you","want!"
119 ]
119 ]
@@ -170,18 +170,18 @@ toReport exit =
170 ]
170 ]
171
171
172 MissingTag version ->
172 MissingTag version ->
173− let vsn = Pkg.versionToString version in
173+ let vsn = V.toChars version in
174 Help.docReport "NO TAG" Nothing
174 Help.docReport "NO TAG" Nothing
175 ( D.fillSep $
175 ( D.fillSep $
176 [ "Packages", "must", "be", "tagged", "in", "git,", "but", "I"
176 [ "Packages", "must", "be", "tagged", "in", "git,", "but", "I"
177− , "cannot", "find", "a", D.green (D.fromString vsn), "tag."
177+ , "cannot", "find", "a", D.green (D.fromChars vsn), "tag."
178 ]
178 ]
179 )
179 )
180 [ D.vcat
180 [ D.vcat
181 [ "These tags make it possible to find this specific version on GitHub."
181 [ "These tags make it possible to find this specific version on GitHub."
182 , "To tag the most recent commit and push it to GitHub, run this:"
182 , "To tag the most recent commit and push it to GitHub, run this:"
183 ]
183 ]
184− , D.indent 4 $ D.dullyellow $ D.vcat $ map D.fromString $
184+ , D.indent 4 $ D.dullyellow $ D.vcat $ map D.fromChars $
185 [ "git tag -a " ++ vsn ++ " -m \"new release\""
185 [ "git tag -a " ++ vsn ++ " -m \"new release\""
186 , "git push origin " ++ vsn
186 , "git push origin " ++ vsn
187 ]
187 ]
@@ -202,10 +202,10 @@ toReport exit =
202 ]
202 ]
203
203
204 LocalChanges version ->
204 LocalChanges version ->
205− let vsn = Pkg.versionToString version in
205+ let vsn = V.toChars version in
206 Help.docReport "LOCAL CHANGES" Nothing
206 Help.docReport "LOCAL CHANGES" Nothing
207 ( D.fillSep $
207 ( D.fillSep $
208− [ "The", "code", "tagged", "as", D.green (D.fromString vsn), "in"
208+ [ "The", "code", "tagged", "as", D.green (D.fromChars vsn), "in"
209 , "git", "does", "not", "match", "the", "code", "in", "your"
209 , "git", "does", "not", "match", "the", "code", "in", "your"
210 , "working", "directory.", "This", "means", "you", "have"
210 , "working", "directory.", "This", "means", "you", "have"
211 , "commits", "or", "local", "changes", "that", "are", "not"
211 , "commits", "or", "local", "changes", "that", "are", "not"
builder/src/Reporting/Progress.hs+9−8
@@ -16,7 +16,8 @@ import Control.Concurrent.Chan (Chan, writeChan)
16import Control.Concurrent.MVar (MVar, newEmptyMVar, readMVar)
16import Control.Concurrent.MVar (MVar, newEmptyMVar, readMVar)
17import qualified Elm.ModuleName as ModuleName
17import qualified Elm.ModuleName as ModuleName
18import Deps.Diff (Magnitude)
18import Deps.Diff (Magnitude)
19−import Elm.Package (Name, Version)
19+import qualified Elm.Package as Pkg
20+import qualified Elm.Version as V
20import qualified Reporting.Doc as D
21import qualified Reporting.Doc as D
21import Reporting.Exit (Exit)
22import Reporting.Exit (Exit)
22
23
@@ -72,9 +73,9 @@ data Msg
72data Progress
73data Progress
73 -- download packages
74 -- download packages
74 = DownloadSkip
75 = DownloadSkip
75− | DownloadStart [(Name, Version)]
76+ | DownloadStart [(Pkg.Name, V.Version)]
76− | DownloadPkgStart Name Version
77+ | DownloadPkgStart Pkg.Name V.Version
77− | DownloadPkgEnd Name Version Outcome
78+ | DownloadPkgEnd Pkg.Name V.Version Outcome
78 | DownloadEnd Outcome
79 | DownloadEnd Outcome
79
80
80 -- build dependencies
81 -- build dependencies
@@ -89,8 +90,8 @@ data Progress
89 | CompileEnd
90 | CompileEnd
90
91
91 -- publish
92 -- publish
92− | PublishStart Name Version (Maybe [Version])
93+ | PublishStart Pkg.Name V.Version (Maybe [V.Version])
93− | PublishCheckBump Version BumpPhase
94+ | PublishCheckBump V.Version BumpPhase
94 | PublishProgress PublishPhase (Maybe Outcome)
95 | PublishProgress PublishPhase (Maybe Outcome)
95 | PublishEnd
96 | PublishEnd
96
97
@@ -104,7 +105,7 @@ data Outcome = Good | Bad
104data PublishPhase
105data PublishPhase
105 = CheckReadme
106 = CheckReadme
106 | CheckLicense
107 | CheckLicense
107− | CheckTag Version
108+ | CheckTag V.Version
108 | CheckDownload
109 | CheckDownload
109 | CheckBuild
110 | CheckBuild
110 | CheckChanges
111 | CheckChanges
@@ -113,5 +114,5 @@ data PublishPhase
113data BumpPhase
114data BumpPhase
114 = StatedVersion
115 = StatedVersion
115 | GoodStart
116 | GoodStart
116− | GoodBump Version Magnitude
117+ | GoodBump V.Version Magnitude
117 | BadBump
118 | BadBump
builder/src/Reporting/Progress/Terminal.hs+19−19
@@ -12,7 +12,7 @@ import Control.Concurrent.MVar (newEmptyMVar, putMVar)
12import qualified System.Info as Info
12import qualified System.Info as Info
13import System.IO (hFlush, hPutStr, stdout)
13import System.IO (hFlush, hPutStr, stdout)
14import qualified Elm.Package as Pkg
14import qualified Elm.Package as Pkg
15−import Elm.Package (Name, Version)
15+import qualified Elm.Version as V
16
16
17import qualified Deps.Diff as Diff
17import qualified Deps.Diff as Diff
18import Reporting.Doc ((<>), (<+>))
18import Reporting.Doc ((<>), (<+>))
@@ -182,7 +182,7 @@ loopHelp chan progress state@(State total good bad) =
182 loop chan state
182 loop chan state
183
183
184 Just _ ->
184 Just _ ->
185− do putStrLn $ unwords [ "Verifying", Pkg.toString name, Pkg.versionToString version, "..." ]
185+ do putStrLn $ unwords [ "Verifying", Pkg.toChars name, V.toChars version, "..." ]
186 putStrLn ""
186 putStrLn ""
187 loop chan state
187 loop chan state
188
188
@@ -214,11 +214,11 @@ loopHelp chan progress state@(State total good bad) =
214-- BULLETS
214-- BULLETS
215
215
216
216
217−makeBullet :: Name -> Version -> Outcome -> D.Doc
217+makeBullet :: Pkg.Name -> V.Version -> Outcome -> D.Doc
218makeBullet name version outcome =
218makeBullet name version outcome =
219 let
219 let
220− nm = D.fromText (Pkg.toText name)
220+ nm = D.fromUtf8 (Pkg.toString name)
221− vsn = D.fromText (Pkg.versionToText version)
221+ vsn = D.fromUtf8 (V.toString version)
222
222
223 bullet =
223 bullet =
224 case outcome of
224 case outcome of
@@ -257,7 +257,7 @@ newPackageOverview =
257 , ""
257 , ""
258 , " - Versions all have exactly three parts: MAJOR.MINOR.PATCH"
258 , " - Versions all have exactly three parts: MAJOR.MINOR.PATCH"
259 , ""
259 , ""
260− , " - All packages start with initial version " ++ Pkg.versionToString Pkg.initialVersion
260+ , " - All packages start with initial version " ++ V.toChars V.one
261 , ""
261 , ""
262 , " - Versions are incremented based on how the API changes:"
262 , " - Versions are incremented based on how the API changes:"
263 , ""
263 , ""
@@ -282,13 +282,13 @@ toChecklistDoc status (ChecklistMessages waiting success failure) =
282 in
282 in
283 case status of
283 case status of
284 Nothing ->
284 Nothing ->
285− " " <> waitingMark <+> D.fromString waiting
285+ " " <> waitingMark <+> D.fromChars waiting
286
286
287 Just Good ->
287 Just Good ->
288− "\r " <> goodMark <+> D.fromString (padded success ++ "\n")
288+ "\r " <> goodMark <+> D.fromChars (padded success ++ "\n")
289
289
290 Just Bad ->
290 Just Bad ->
291− "\r " <> badMark <+> D.fromString (padded failure ++ "\n\n")
291+ "\r " <> badMark <+> D.fromChars (padded failure ++ "\n\n")
292
292
293
293
294data ChecklistMessages =
294data ChecklistMessages =
@@ -316,9 +316,9 @@ toChecklistMessages phase =
316
316
317 CheckTag version ->
317 CheckTag version ->
318 ChecklistMessages
318 ChecklistMessages
319− ("Is version " ++ Pkg.versionToString version ++ " tagged on GitHub?")
319+ ("Is version " ++ V.toChars version ++ " tagged on GitHub?")
320− ("Version " ++ Pkg.versionToString version ++ " is tagged on GitHub")
320+ ("Version " ++ V.toChars version ++ " is tagged on GitHub")
321− ("Version " ++ Pkg.versionToString version ++ " is not tagged on GitHub!")
321+ ("Version " ++ V.toChars version ++ " is not tagged on GitHub!")
322
322
323 CheckDownload ->
323 CheckDownload ->
324 ChecklistMessages
324 ChecklistMessages
@@ -343,14 +343,14 @@ toChecklistMessages phase =
343-- BUMP PHASE
343-- BUMP PHASE
344
344
345
345
346−bumpPhaseToChecklistDoc :: Pkg.Version -> BumpPhase -> D.Doc
346+bumpPhaseToChecklistDoc :: V.Version -> BumpPhase -> D.Doc
347bumpPhaseToChecklistDoc version bumpPhase =
347bumpPhaseToChecklistDoc version bumpPhase =
348 let
348 let
349 mkMsgs success =
349 mkMsgs success =
350 ChecklistMessages
350 ChecklistMessages
351− ("Checking semantic versioning rules. Is " ++ Pkg.versionToString version ++ " correct?")
351+ ("Checking semantic versioning rules. Is " ++ V.toChars version ++ " correct?")
352 success
352 success
353− ("Version " ++ Pkg.versionToString version ++ " is not correct!")
353+ ("Version " ++ V.toChars version ++ " is not correct!")
354 in
354 in
355
355
356 case bumpPhase of
356 case bumpPhase of
@@ -359,7 +359,7 @@ bumpPhaseToChecklistDoc version bumpPhase =
359
359
360 GoodStart ->
360 GoodStart ->
361 toChecklistDoc (Just Good) $ mkMsgs $
361 toChecklistDoc (Just Good) $ mkMsgs $
362− "All packages start at version " ++ Pkg.versionToString Pkg.initialVersion
362+ "All packages start at version " ++ V.toChars V.one
363
363
364 GoodBump old magnitude ->
364 GoodBump old magnitude ->
365 toChecklistDoc (Just Good) $ mkMsgs $
365 toChecklistDoc (Just Good) $ mkMsgs $
@@ -369,11 +369,11 @@ bumpPhaseToChecklistDoc version bumpPhase =
369 toChecklistDoc (Just Bad) $ mkMsgs ""
369 toChecklistDoc (Just Bad) $ mkMsgs ""
370
370
371
371
372−toCheckVersionSuccessMessage :: Pkg.Version -> Pkg.Version -> Diff.Magnitude -> String
372+toCheckVersionSuccessMessage :: V.Version -> V.Version -> Diff.Magnitude -> String
373toCheckVersionSuccessMessage oldVersion newVersion magnitude =
373toCheckVersionSuccessMessage oldVersion newVersion magnitude =
374 let
374 let
375− old = Pkg.versionToString oldVersion
375+ old = V.toChars oldVersion
376− new = Pkg.versionToString newVersion
376+ new = V.toChars newVersion
377 mag = Diff.magnitudeToString magnitude
377 mag = Diff.magnitudeToString magnitude
378 in
378 in
379 "Version number " ++ new ++ " verified (" ++ mag ++ " change, " ++ old ++ " => " ++ new ++ ")"
379 "Version number " ++ new ++ " verified (" ++ mag ++ " change, " ++ old ++ " => " ++ new ++ ")"
builder/src/Reporting/Task.hs+3−3
@@ -30,9 +30,9 @@ import qualified System.Directory as Dir
30import qualified System.Exit as Exit
30import qualified System.Exit as Exit
31import System.FilePath ((</>))
31import System.FilePath ((</>))
32
32
33−import Elm.Package (Name, Version)
34import qualified Elm.Package as Pkg
33import qualified Elm.Package as Pkg
35import qualified Elm.PerUserCache as PerUserCache
34import qualified Elm.PerUserCache as PerUserCache
35+import qualified Elm.Version as V
36import qualified Reporting.Doc as D
36import qualified Reporting.Doc as D
37import qualified Reporting.Exit as Exit
37import qualified Reporting.Exit as Exit
38import qualified Reporting.Progress as Progress
38import qualified Reporting.Progress as Progress
@@ -104,10 +104,10 @@ getPackageCacheDir =
104 R.asks _cacheDir
104 R.asks _cacheDir
105
105
106
106
107−getPackageCacheDirFor :: Name -> Version -> Task_ e FilePath
107+getPackageCacheDirFor :: Pkg.Name -> V.Version -> Task_ e FilePath
108getPackageCacheDirFor name version =
108getPackageCacheDirFor name version =
109 do cacheDir <- getPackageCacheDir
109 do cacheDir <- getPackageCacheDir
110− let dir = cacheDir </> Pkg.toFilePath name </> Pkg.versionToString version
110+ let dir = cacheDir </> Pkg.toFilePath name </> V.toChars version
111 liftIO (Dir.createDirectoryIfMissing True dir)
111 liftIO (Dir.createDirectoryIfMissing True dir)
112 return dir
112 return dir
113
113
builder/src/Reporting/Task/Http.hs+2−3
@@ -23,8 +23,7 @@ import qualified Network.HTTP as Http (urlEncodeVars)
23import qualified Network.HTTP.Client as Http
23import qualified Network.HTTP.Client as Http
24import qualified Network.HTTP.Types.Header as Http (hAcceptEncoding, hUserAgent)
24import qualified Network.HTTP.Types.Header as Http (hAcceptEncoding, hUserAgent)
25
25
26−import qualified Elm.Compiler as Compiler
26+import qualified Elm.Version as V
27−import qualified Elm.Package as Pkg
28import qualified Reporting.Exit as Exit
27import qualified Reporting.Exit as Exit
29import qualified Reporting.Exit.Http as E
28import qualified Reporting.Exit.Http as E
30import qualified Reporting.Progress as Progress
29import qualified Reporting.Progress as Progress
@@ -192,4 +191,4 @@ addHeaders request =
192{-# NOINLINE userAgent #-}
191{-# NOINLINE userAgent #-}
193userAgent :: BS.ByteString
192userAgent :: BS.ByteString
194userAgent =
193userAgent =
195− BS.pack ("elm/" ++ Pkg.versionToString Compiler.version)
194+ BS.pack ("elm/" ++ V.toChars V.compiler)
builder/src/Stuff/Paths.hs+2−3
@@ -16,9 +16,8 @@ import Control.Monad.Trans (liftIO)
16import qualified System.Directory as Dir
16import qualified System.Directory as Dir
17import System.FilePath ((</>), (<.>))
17import System.FilePath ((</>), (<.>))
18
18
19−import qualified Elm.Compiler as Compiler
20import qualified Elm.ModuleName as ModuleName
19import qualified Elm.ModuleName as ModuleName
21−import qualified Elm.Package as Pkg
20+import qualified Elm.Version as V
22import qualified Reporting.Task as Task
21import qualified Reporting.Task as Task
23
22
24
23
@@ -28,7 +27,7 @@ import qualified Reporting.Task as Task
28
27
29stuff :: FilePath
28stuff :: FilePath
30stuff =
29stuff =
31− "elm-stuff" </> Pkg.versionToString Compiler.version
30+ "elm-stuff" </> V.toChars V.compiler
32
31
33
32
34docs :: FilePath
33docs :: FilePath