@@ -16,7 +16,7 @@ import qualified Data.Text.Encoding as Text
1616import qualified Data.Time.Clock as Time
1717
1818import qualified Elm.Compiler as Compiler
19−import qualified Elm.Compiler.Module as Module
19+import qualified Elm.ModuleName as ModuleName
2020import qualified Elm.Package as Pkg
2121import Reporting.Doc ((<+>), (<>))
2222import qualified Reporting.Doc as D
@@ -30,30 +30,30 @@ import qualified Reporting.Exit.Help as Help
3030
3131data Exit
3232 = RootFileNotFound FilePath
33− | RootModuleNameDuplicate Module.Raw [FilePath]
33+ | RootModuleNameDuplicate ModuleName.Raw [FilePath]
3434 | RootNameless FilePath
3535 | DependencyProblems Problem [Problem]
3636 | BadKernelHeader FilePath
3737
3838
3939data Problem
40− = ModuleNotFound Origin Module.Raw SrcDirs
41− | ModuleAmbiguous Origin Module.Raw [FilePath] [Pkg.Package]
40+ = ModuleNotFound Origin ModuleName.Raw SrcDirs
41+ | ModuleAmbiguous Origin ModuleName.Raw [FilePath] [Pkg.Canonical]
4242 | BadHeader FilePath Time.UTCTime BS.ByteString Compiler.Error
43− | ModuleNameReservedForKernel Origin Module.Raw
44− | ModuleNameMissing FilePath Module.Raw
43+ | ModuleNameReservedForKernel Origin ModuleName.Raw
44+ | ModuleNameMissing FilePath ModuleName.Raw
4545 | ModuleNameMismatch
4646 FilePath
47− Module.Raw -- expected
48− Module.Raw -- actual
49− | PortsInPackage FilePath Module.Raw
50− | EffectsUnexpected FilePath Module.Raw
47+ ModuleName.Raw -- expected
48+ ModuleName.Raw -- actual
49+ | PortsInPackage FilePath ModuleName.Raw
50+ | EffectsUnexpected FilePath ModuleName.Raw
5151
5252
5353data Origin
5454 = ElmJson
5555 | File FilePath
56− | Module FilePath Module.Raw
56+ | Module FilePath ModuleName.Raw
5757
5858
5959data SrcDirs
@@ -82,7 +82,7 @@ toReport exit =
8282 map D.fromString paths
8383 , D.fillSep $
8484 [ "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)) <> "."
8686 , "Change", "them", "to", "have", "unique", "names", "and", "you"
8787 , "should", "be", "all", "set!"
8888 ]
@@ -139,9 +139,9 @@ problemToReport problem =
139139 Help.report "MODULE NAME MISMATCH" (Just path)
140140 ( "The file at " ++ path ++ " has a typo in the module name. It says:"
141141 )
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 (..)"
143143 , "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 (..)"
145145 , "Make the change and you should be all set!"
146146 ]
147147
@@ -159,7 +159,7 @@ problemToReport problem =
159159 \ cautious in expanding its usage."
160160
161161
162−badTagToDoc :: FilePath -> Module.Raw -> String -> String -> String -> Help.Report
162+badTagToDoc :: FilePath -> ModuleName.Raw -> String -> String -> String -> Help.Report
163163badTagToDoc path name tag hintName summary =
164164 Help.report
165165 ("UNEXPECTED " ++ map Char.toUpper tag ++ " MODULE")
@@ -169,7 +169,7 @@ badTagToDoc path name tag hintName summary =
169169 [ "Get", "rid", "of", "all", "the"
170170 , D.red (D.fromString tag)
171171 , "stuff", "in"
172− , D.dullyellow (D.fromString (Module.nameToString name))
172+ , D.dullyellow (D.fromString (ModuleName.nameToString name))
173173 , "to", "proceed."
174174 ]
175175 , D.toSimpleNote $
@@ -182,14 +182,14 @@ badTagToDoc path name tag hintName summary =
182182-- NAMELESS
183183
184184
185−namelessToDoc :: FilePath -> Module.Raw -> Help.Report
185+namelessToDoc :: FilePath -> ModuleName.Raw -> Help.Report
186186namelessToDoc path name =
187187 Help.report "UNNAMED MODULE" (Just path)
188− ( "The `" ++ Module.nameToString name
188+ ( "The `" ++ ModuleName.nameToString name
189189 ++ "` module must start with a line like this:"
190190 )
191191 [ D.indent 4 $ D.dullyellow $ D.fromString $
192− "module " ++ Module.nameToString name ++ " exposing (..)"
192+ "module " ++ ModuleName.nameToString name ++ " exposing (..)"
193193 , D.reflow $
194194 "Try adding that as the first line of your file!"
195195 , D.toSimpleNote $
@@ -204,33 +204,33 @@ namelessToDoc path name =
204204-- NOT FOUND
205205
206206
207−notFoundToDoc :: Origin -> Module.Raw -> SrcDirs -> Help.Report
207+notFoundToDoc :: Origin -> ModuleName.Raw -> SrcDirs -> Help.Report
208208notFoundToDoc origin child srcDirs =
209209 case origin of
210210 ElmJson ->
211211 Help.report "MODULE NOT FOUND" (Just "elm.json")
212212 "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
214214 , D.reflow $
215215 "When creating packages, all modules must live in the src/ directory."
216216 ]
217217
218218 File path ->
219219 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.")
221221 (notFoundDetails child srcDirs)
222222
223223 Module path parent ->
224224 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:")
226226 (notFoundDetails child srcDirs)
227227
228228
229−notFoundDetails :: Module.Raw -> SrcDirs -> [D.Doc]
229+notFoundDetails :: ModuleName.Raw -> SrcDirs -> [D.Doc]
230230notFoundDetails child srcDirs =
231231 let
232232 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
234234 in
235235 case Map.lookup child Pkg.suggestions of
236236 Just pkg ->
@@ -243,13 +243,13 @@ notFoundDetails child srcDirs =
243243 Pkg ->
244244 D.reflow $
245245 "If you want a local file, make sure the `"
246− ++ Module.nameToString child
246+ ++ ModuleName.nameToString child
247247 ++ "` module is in your src/ directory."
248248
249249 App _ ->
250250 D.reflow $
251251 "If you want a local file, make sure the `"
252− ++ Module.nameToString child
252+ ++ ModuleName.nameToString child
253253 ++ "` module is in one of the \"source-directories\" listed in your elm.json file."
254254 ]
255255
@@ -275,10 +275,10 @@ notFoundDetails child srcDirs =
275275 ]
276276
277277
278−ambiguousToDoc :: Origin -> Module.Raw -> [FilePath] -> [Pkg.Package] -> Help.Report
278+ambiguousToDoc :: Origin -> ModuleName.Raw -> [FilePath] -> [Pkg.Canonical] -> Help.Report
279279ambiguousToDoc origin child paths pkgs =
280280 let
281− pkgToString (Pkg.Package pkg vsn) =
281+ pkgToString (Pkg.Canonical pkg vsn) =
282282 "exposed by " ++ Pkg.toString pkg ++ " " ++ Pkg.versionToString vsn
283283
284284 makeReport maybePath summary yellowString =
@@ -303,22 +303,22 @@ ambiguousToDoc origin child paths pkgs =
303303 makeReport
304304 Nothing
305305 "Your elm.json wants the following module:"
306− (Module.nameToString child)
306+ (ModuleName.nameToString child)
307307
308308 File path ->
309309 makeReport
310310 (Just path)
311311 ("The file at " ++ path ++ " has an ambiguous import:")
312− ("import " ++ Module.nameToString child)
312+ ("import " ++ ModuleName.nameToString child)
313313
314314 Module path parent ->
315315 makeReport
316316 (Just path)
317− ("The " ++ Module.nameToString parent ++ " module has an ambiguous import:")
318− ("import " ++ Module.nameToString child)
317+ ("The " ++ ModuleName.nameToString parent ++ " module has an ambiguous import:")
318+ ("import " ++ ModuleName.nameToString child)
319319
320320
321−kernelNameToDoc :: Origin -> Module.Raw -> Help.Report
321+kernelNameToDoc :: Origin -> ModuleName.Raw -> Help.Report
322322kernelNameToDoc origin kernelName =
323323 let
324324 (maybePath, statement) =
@@ -335,11 +335,11 @@ kernelNameToDoc origin kernelName =
335335
336336 Module path parent ->
337337 ( Just path
338− , "Your " ++ Module.nameToString parent ++ " module is trying to import:"
338+ , "Your " ++ ModuleName.nameToString parent ++ " module is trying to import:"
339339 )
340340 in
341341 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
343343 , D.reflow $
344344 "But names like that are reserved for internal use.\
345345 \ Switch to a name outside of the Elm/Kernel/ namespace."