@@ -16,7 +16,7 @@ import qualified Data.Text.Encoding as Text
16import qualified Data.Time.Clock as Time
16import qualified Data.Time.Clock as Time
18import qualified Elm.Compiler as Compiler
18import qualified Elm.Compiler as Compiler
19−import qualified Elm.Compiler.Module as Module
19+import qualified Elm.ModuleName as ModuleName
20import qualified Elm.Package as Pkg
20import qualified Elm.Package as Pkg
21import Reporting.Doc ((<+>), (<>))
21import Reporting.Doc ((<+>), (<>))
22import qualified Reporting.Doc as D
22import qualified Reporting.Doc as D
@@ -30,30 +30,30 @@ import qualified Reporting.Exit.Help as Help
32 = RootFileNotFound FilePath
32 = RootFileNotFound FilePath
33− | RootModuleNameDuplicate Module.Raw [FilePath]
33+ | RootModuleNameDuplicate ModuleName.Raw [FilePath]
34 | RootNameless FilePath
34 | RootNameless FilePath
35 | DependencyProblems Problem [Problem]
35 | DependencyProblems Problem [Problem]
36 | BadKernelHeader FilePath
36 | BadKernelHeader FilePath
39data Problem
39data Problem
40− = ModuleNotFound Origin Module.Raw SrcDirs
40+ = ModuleNotFound Origin ModuleName.Raw SrcDirs
41− | ModuleAmbiguous Origin Module.Raw [FilePath] [Pkg.Package]
41+ | ModuleAmbiguous Origin ModuleName.Raw [FilePath] [Pkg.Canonical]
42 | BadHeader FilePath Time.UTCTime BS.ByteString Compiler.Error
42 | BadHeader FilePath Time.UTCTime BS.ByteString Compiler.Error
43− | ModuleNameReservedForKernel Origin Module.Raw
43+ | ModuleNameReservedForKernel Origin ModuleName.Raw
44− | ModuleNameMissing FilePath Module.Raw
44+ | ModuleNameMissing FilePath ModuleName.Raw
45 | ModuleNameMismatch
45 | ModuleNameMismatch
47− Module.Raw -- expected
47+ ModuleName.Raw -- expected
48− Module.Raw -- actual
48+ ModuleName.Raw -- actual
49− | PortsInPackage FilePath Module.Raw
49+ | PortsInPackage FilePath ModuleName.Raw
50− | EffectsUnexpected FilePath Module.Raw
50+ | EffectsUnexpected FilePath ModuleName.Raw
53data Origin
53data Origin
55 | File FilePath
55 | File FilePath
56− | Module FilePath Module.Raw
56+ | Module FilePath ModuleName.Raw
59data SrcDirs
59data SrcDirs
@@ -82,7 +82,7 @@ toReport exit =
82 map D.fromString paths
82 map D.fromString paths
83 , D.fillSep $
83 , D.fillSep $
84 [ "These", "modules", if length paths == 2 then "both" else "all", "claim"
84 [ "These", "modules", if length paths == 2 then "both" else "all", "claim"
85− , "to", "be", "named", D.dullyellow (D.fromString (Module.nameToString name)) <> "."
85+ , "to", "be", "named", D.dullyellow (D.fromString (ModuleName.nameToString name)) <> "."
86 , "Change", "them", "to", "have", "unique", "names", "and", "you"
86 , "Change", "them", "to", "have", "unique", "names", "and", "you"
87 , "should", "be", "all", "set!"
87 , "should", "be", "all", "set!"
@@ -139,9 +139,9 @@ problemToReport problem =
139 Help.report "MODULE NAME MISMATCH" (Just path)
139 Help.report "MODULE NAME MISMATCH" (Just path)
140 ( "The file at " ++ path ++ " has a typo in the module name. It says:"
140 ( "The file at " ++ path ++ " has a typo in the module name. It says:"
142− [ D.indent 4 $ D.dullyellow $ "module" <+> D.red (D.fromString (Module.nameToString actual)) <+> "exposing (..)"
142+ [ D.indent 4 $ D.dullyellow $ "module" <+> D.red (D.fromString (ModuleName.nameToString actual)) <+> "exposing (..)"
143 , "Looks like a typo or copy/paste error. Instead it needs to say:"
143 , "Looks like a typo or copy/paste error. Instead it needs to say:"
144− , D.indent 4 $ D.dullyellow $ "module" <+> D.green (D.fromString (Module.nameToString expected)) <+> "exposing (..)"
144+ , D.indent 4 $ D.dullyellow $ "module" <+> D.green (D.fromString (ModuleName.nameToString expected)) <+> "exposing (..)"
145 , "Make the change and you should be all set!"
145 , "Make the change and you should be all set!"
@@ -159,7 +159,7 @@ problemToReport problem =
159 \ cautious in expanding its usage."
159 \ cautious in expanding its usage."
162−badTagToDoc :: FilePath -> Module.Raw -> String -> String -> String -> Help.Report
162+badTagToDoc :: FilePath -> ModuleName.Raw -> String -> String -> String -> Help.Report
163badTagToDoc path name tag hintName summary =
163badTagToDoc path name tag hintName summary =
164 Help.report
164 Help.report
165 ("UNEXPECTED " ++ map Char.toUpper tag ++ " MODULE")
165 ("UNEXPECTED " ++ map Char.toUpper tag ++ " MODULE")
@@ -169,7 +169,7 @@ badTagToDoc path name tag hintName summary =
169 [ "Get", "rid", "of", "all", "the"
169 [ "Get", "rid", "of", "all", "the"
170 , D.red (D.fromString tag)
170 , D.red (D.fromString tag)
171 , "stuff", "in"
171 , "stuff", "in"
172− , D.dullyellow (D.fromString (Module.nameToString name))
172+ , D.dullyellow (D.fromString (ModuleName.nameToString name))
173 , "to", "proceed."
173 , "to", "proceed."
175 , D.toSimpleNote $
175 , D.toSimpleNote $
@@ -182,14 +182,14 @@ badTagToDoc path name tag hintName summary =
182-- NAMELESS
182-- NAMELESS
185−namelessToDoc :: FilePath -> Module.Raw -> Help.Report
185+namelessToDoc :: FilePath -> ModuleName.Raw -> Help.Report
186namelessToDoc path name =
186namelessToDoc path name =
187 Help.report "UNNAMED MODULE" (Just path)
187 Help.report "UNNAMED MODULE" (Just path)
188− ( "The `" ++ Module.nameToString name
188+ ( "The `" ++ ModuleName.nameToString name
189 ++ "` module must start with a line like this:"
189 ++ "` module must start with a line like this:"
191 [ D.indent 4 $ D.dullyellow $ D.fromString $
191 [ D.indent 4 $ D.dullyellow $ D.fromString $
192− "module " ++ Module.nameToString name ++ " exposing (..)"
192+ "module " ++ ModuleName.nameToString name ++ " exposing (..)"
193 , D.reflow $
193 , D.reflow $
194 "Try adding that as the first line of your file!"
194 "Try adding that as the first line of your file!"
195 , D.toSimpleNote $
195 , D.toSimpleNote $
@@ -204,33 +204,33 @@ namelessToDoc path name =
204-- NOT FOUND
204-- NOT FOUND
207−notFoundToDoc :: Origin -> Module.Raw -> SrcDirs -> Help.Report
207+notFoundToDoc :: Origin -> ModuleName.Raw -> SrcDirs -> Help.Report
208notFoundToDoc origin child srcDirs =
208notFoundToDoc origin child srcDirs =
209 case origin of
209 case origin of
210 ElmJson ->
210 ElmJson ->
211 Help.report "MODULE NOT FOUND" (Just "elm.json")
211 Help.report "MODULE NOT FOUND" (Just "elm.json")
212 "Your elm.json says your project has the following module:"
212 "Your elm.json says your project has the following module:"
213− [ D.indent 4 $ D.red $ D.fromString $ Module.nameToString child
213+ [ D.indent 4 $ D.red $ D.fromString $ ModuleName.nameToString child
214 , D.reflow $
214 , D.reflow $
215 "When creating packages, all modules must live in the src/ directory."
215 "When creating packages, all modules must live in the src/ directory."
218 File path ->
218 File path ->
219 Help.report "UNKNOWN IMPORT" (Just path)
219 Help.report "UNKNOWN IMPORT" (Just path)
220− ("I cannot find a `" ++ Module.nameToString child ++ "` module to import.")
220+ ("I cannot find a `" ++ ModuleName.nameToString child ++ "` module to import.")
221 (notFoundDetails child srcDirs)
221 (notFoundDetails child srcDirs)
223 Module path parent ->
223 Module path parent ->
224 Help.report "UNKNOWN IMPORT" (Just path)
224 Help.report "UNKNOWN IMPORT" (Just path)
225− ("The " ++ Module.nameToString parent ++ " module has a bad import:")
225+ ("The " ++ ModuleName.nameToString parent ++ " module has a bad import:")
226 (notFoundDetails child srcDirs)
226 (notFoundDetails child srcDirs)
229−notFoundDetails :: Module.Raw -> SrcDirs -> [D.Doc]
229+notFoundDetails :: ModuleName.Raw -> SrcDirs -> [D.Doc]
230notFoundDetails child srcDirs =
230notFoundDetails child srcDirs =
232 simulatedCode =
232 simulatedCode =
233− D.indent 4 $ D.red $ D.fromString $ "import " ++ Module.nameToString child
233+ D.indent 4 $ D.red $ D.fromString $ "import " ++ ModuleName.nameToString child
235 case Map.lookup child Pkg.suggestions of
235 case Map.lookup child Pkg.suggestions of
236 Just pkg ->
236 Just pkg ->
@@ -243,13 +243,13 @@ notFoundDetails child srcDirs =
244 D.reflow $
244 D.reflow $
245 "If you want a local file, make sure the `"
245 "If you want a local file, make sure the `"
246− ++ Module.nameToString child
246+ ++ ModuleName.nameToString child
247 ++ "` module is in your src/ directory."
247 ++ "` module is in your src/ directory."
250 D.reflow $
250 D.reflow $
251 "If you want a local file, make sure the `"
251 "If you want a local file, make sure the `"
252− ++ Module.nameToString child
252+ ++ ModuleName.nameToString child
253 ++ "` module is in one of the \"source-directories\" listed in your elm.json file."
253 ++ "` module is in one of the \"source-directories\" listed in your elm.json file."
@@ -275,10 +275,10 @@ notFoundDetails child srcDirs =
278−ambiguousToDoc :: Origin -> Module.Raw -> [FilePath] -> [Pkg.Package] -> Help.Report
278+ambiguousToDoc :: Origin -> ModuleName.Raw -> [FilePath] -> [Pkg.Canonical] -> Help.Report
279ambiguousToDoc origin child paths pkgs =
279ambiguousToDoc origin child paths pkgs =
281− pkgToString (Pkg.Package pkg vsn) =
281+ pkgToString (Pkg.Canonical pkg vsn) =
282 "exposed by " ++ Pkg.toString pkg ++ " " ++ Pkg.versionToString vsn
282 "exposed by " ++ Pkg.toString pkg ++ " " ++ Pkg.versionToString vsn
284 makeReport maybePath summary yellowString =
284 makeReport maybePath summary yellowString =
@@ -303,22 +303,22 @@ ambiguousToDoc origin child paths pkgs =
303 makeReport
303 makeReport
305 "Your elm.json wants the following module:"
305 "Your elm.json wants the following module:"
306− (Module.nameToString child)
306+ (ModuleName.nameToString child)
308 File path ->
308 File path ->
309 makeReport
309 makeReport
310 (Just path)
310 (Just path)
311 ("The file at " ++ path ++ " has an ambiguous import:")
311 ("The file at " ++ path ++ " has an ambiguous import:")
312− ("import " ++ Module.nameToString child)
312+ ("import " ++ ModuleName.nameToString child)
314 Module path parent ->
314 Module path parent ->
315 makeReport
315 makeReport
316 (Just path)
316 (Just path)
317− ("The " ++ Module.nameToString parent ++ " module has an ambiguous import:")
317+ ("The " ++ ModuleName.nameToString parent ++ " module has an ambiguous import:")
318− ("import " ++ Module.nameToString child)
318+ ("import " ++ ModuleName.nameToString child)
321−kernelNameToDoc :: Origin -> Module.Raw -> Help.Report
321+kernelNameToDoc :: Origin -> ModuleName.Raw -> Help.Report
322kernelNameToDoc origin kernelName =
322kernelNameToDoc origin kernelName =
324 (maybePath, statement) =
324 (maybePath, statement) =
@@ -335,11 +335,11 @@ kernelNameToDoc origin kernelName =
336 Module path parent ->
336 Module path parent ->
337 ( Just path
337 ( Just path
338− , "Your " ++ Module.nameToString parent ++ " module is trying to import:"
338+ , "Your " ++ ModuleName.nameToString parent ++ " module is trying to import:"
341 Help.report "BAD MODULE NAME" maybePath statement
341 Help.report "BAD MODULE NAME" maybePath statement
342− [ D.indent 4 $ D.dullyellow $ D.fromString $ Module.nameToString kernelName
342+ [ D.indent 4 $ D.dullyellow $ D.fromString $ ModuleName.nameToString kernelName
343 , D.reflow $
343 , D.reflow $
344 "But names like that are reserved for internal use.\
344 "But names like that are reserved for internal use.\
345 \ Switch to a name outside of the Elm/Kernel/ namespace."
345 \ Switch to a name outside of the Elm/Kernel/ namespace."