on master help sign in
Update builder/* for new Elm.ModuleName module
c31b96dEvan Czaplicki
builder/src/Deps/Diff.hs+4−4
@@ -21,9 +21,9 @@ import qualified Data.Name as Name
21import qualified Data.Set as Set
21import qualified Data.Set as Set
22import qualified Data.Text as Text
22import qualified Data.Text as Text
23
23
24−import qualified Elm.Compiler.Module as Module
25import qualified Elm.Compiler.Type as Type
24import qualified Elm.Compiler.Type as Type
26import qualified Elm.Docs as Docs
25import qualified Elm.Docs as Docs
26+import qualified Elm.ModuleName as ModuleName
27import qualified Elm.Package as Pkg
27import qualified Elm.Package as Pkg
28
28
29
29
@@ -33,9 +33,9 @@ import qualified Elm.Package as Pkg
33
33
34data PackageChanges =
34data PackageChanges =
35 PackageChanges
35 PackageChanges
36− { _modules_added :: [Module.Raw]
36+ { _modules_added :: [ModuleName.Raw]
37− , _modules_changed :: Map.Map Module.Raw ModuleChanges
37+ , _modules_changed :: Map.Map ModuleName.Raw ModuleChanges
38− , _modules_removed :: [Module.Raw]
38+ , _modules_removed :: [ModuleName.Raw]
39 }
39 }
40
40
41
41
builder/src/Deps/Verify.hs+11−10
@@ -16,9 +16,10 @@ import Data.Set (Set)
16import System.Directory (doesDirectoryExist)
16import System.Directory (doesDirectoryExist)
17import System.FilePath ((</>))
17import System.FilePath ((</>))
18
18
19−import qualified Elm.Compiler.Module as Module
20import qualified Elm.Compiler.Objects as Obj
19import qualified Elm.Compiler.Objects as Obj
21import qualified Elm.Docs as Docs
20import qualified Elm.Docs as Docs
21+import qualified Elm.Interface as I
22+import qualified Elm.ModuleName as ModuleName
22import Elm.Package (Name, Version)
23import Elm.Package (Name, Version)
23import qualified Elm.PerUserCache as PerUserCache
24import qualified Elm.PerUserCache as PerUserCache
24import Elm.Project.Json (Project(..), AppInfo(..), PkgInfo(..))
25import Elm.Project.Json (Project(..), AppInfo(..), PkgInfo(..))
@@ -176,12 +177,12 @@ verifyBuildArtifacts solution =
176
177
177
178
178data RawInfo =
179data RawInfo =
179− RawInfo (Map Name PkgInfo) Module.Interfaces
180+ RawInfo (Map Name PkgInfo) I.Interfaces
180
181
181
182
182verifyBuild
183verifyBuild
183 :: MVar (Map Name (MVar Answer))
184 :: MVar (Map Name (MVar Answer))
184− -> MVar Module.Interfaces
185+ -> MVar I.Interfaces
185 -> Name
186 -> Name
186 -> Version
187 -> Version
187 -> Task.Task (MVar Answer)
188 -> Task.Task (MVar Answer)
@@ -266,8 +267,8 @@ getIface
266 -> Version
267 -> Version
267 -> PkgInfo
268 -> PkgInfo
268 -> Map Name PkgInfo
269 -> Map Name PkgInfo
269− -> Module.Interfaces
270+ -> I.Interfaces
270− -> Task.Task Module.Interfaces
271+ -> Task.Task I.Interfaces
271getIface name version info infos depIfaces =
272getIface name version info infos depIfaces =
272 do root <- Task.getPackageCacheDirFor name version
273 do root <- Task.getPackageCacheDirFor name version
273 let solution = Map.map _pkg_version infos
274 let solution = Map.map _pkg_version infos
@@ -328,8 +329,8 @@ updateCache
328 -> PkgInfo
329 -> PkgInfo
329 -> Map Name Version
330 -> Map Name Version
330 -> Crawl.Result
331 -> Crawl.Result
331− -> Map Module.Raw Compiler.Artifacts
332+ -> Map ModuleName.Raw Compiler.Artifacts
332− -> Task.Task Module.Interfaces
333+ -> Task.Task I.Interfaces
333updateCache root name info solution graph results =
334updateCache root name info solution graph results =
334 do let path = root </> "cached.dat"
335 do let path = root </> "cached.dat"
335 let deps = Map.map Set.singleton solution
336 let deps = Map.map Set.singleton solution
@@ -360,17 +361,17 @@ updateCache root name info solution graph results =
360-- CRUSH INTERFACES
361-- CRUSH INTERFACES
361
362
362
363
363−crush :: Name -> PkgInfo -> Map Module.Raw Compiler.Artifacts -> Module.Interfaces
364+crush :: Name -> PkgInfo -> Map ModuleName.Raw Compiler.Artifacts -> I.Interfaces
364crush pkg info results =
365crush pkg info results =
365 let
366 let
366 exposed =
367 exposed =
367 Set.fromList (Project.getExposed info)
368 Set.fromList (Project.getExposed info)
368 in
369 in
369− Map.mapKeys (Module.Canonical pkg) $
370+ Map.mapKeys (ModuleName.Canonical pkg) $
370 Map.mapMaybeWithKey (crushHelp exposed) results
371 Map.mapMaybeWithKey (crushHelp exposed) results
371
372
372
373
373−crushHelp :: Set Module.Raw -> Module.Raw -> Compiler.Artifacts -> Maybe Module.Interface
374+crushHelp :: Set ModuleName.Raw -> ModuleName.Raw -> Compiler.Artifacts -> Maybe I.Interface
374crushHelp exposed name (Compiler.Artifacts elmi _ _) =
375crushHelp exposed name (Compiler.Artifacts elmi _ _) =
375 if Set.member name exposed then
376 if Set.member name exposed then
376 Just elmi
377 Just elmi
builder/src/Elm/Diff.hs+3−3
@@ -16,9 +16,9 @@ import qualified Data.Name as Name
16import qualified Deps.Cache as Cache
16import qualified Deps.Cache as Cache
17import Deps.Diff (PackageChanges(..), ModuleChanges(..), Changes(..), Magnitude(..))
17import Deps.Diff (PackageChanges(..), ModuleChanges(..), Changes(..), Magnitude(..))
18import qualified Deps.Diff as Diff
18import qualified Deps.Diff as Diff
19−import qualified Elm.Compiler.Module as Module
20import qualified Elm.Compiler.Type as Type
19import qualified Elm.Compiler.Type as Type
21import qualified Elm.Docs as Docs
20import qualified Elm.Docs as Docs
21+import qualified Elm.ModuleName as ModuleName
22import qualified Elm.Package as Pkg
22import qualified Elm.Package as Pkg
23import qualified Elm.Project as Project
23import qualified Elm.Project as Project
24import qualified Elm.Project.Json as Project
24import qualified Elm.Project.Json as Project
@@ -142,13 +142,13 @@ toDoc localizer changes@(PackageChanges added changed removed) =
142 addedChunk =
142 addedChunk =
143 if null added then [] else
143 if null added then [] else
144 [ Chunk "ADDED MODULES" MINOR $
144 [ Chunk "ADDED MODULES" MINOR $
145− D.vcat $ map (D.fromString . Module.nameToString) added
145+ D.vcat $ map (D.fromString . ModuleName.nameToString) added
146 ]
146 ]
147
147
148 removedChunk =
148 removedChunk =
149 if null removed then [] else
149 if null removed then [] else
150 [ Chunk "REMOVED MODULES" MAJOR $
150 [ Chunk "REMOVED MODULES" MAJOR $
151− D.vcat $ map (D.fromString . Module.nameToString) removed
151+ D.vcat $ map (D.fromString . ModuleName.nameToString) removed
152 ]
152 ]
153
153
154 chunks =
154 chunks =
builder/src/Elm/Project/Json.hs+7−7
@@ -31,7 +31,7 @@ import qualified Data.Text as Text
31import qualified System.Directory as Dir
31import qualified System.Directory as Dir
32import System.FilePath ((</>))
32import System.FilePath ((</>))
33
33
34−import qualified Elm.Compiler.Module as Module
34+import qualified Elm.ModuleName as ModuleName
35import qualified Elm.Package as Pkg
35import qualified Elm.Package as Pkg
36import Elm.Package (Name, Version)
36import Elm.Package (Name, Version)
37
37
@@ -86,8 +86,8 @@ data PkgInfo =
86
86
87
87
88data Exposed
88data Exposed
89− = ExposedList [Module.Raw]
89+ = ExposedList [ModuleName.Raw]
90− | ExposedDict [(Text, [Module.Raw])]
90+ | ExposedDict [(Text, [ModuleName.Raw])]
91
91
92
92
93
93
@@ -127,7 +127,7 @@ getName project =
127 _pkg_name info
127 _pkg_name info
128
128
129
129
130−getExposed :: PkgInfo -> [Module.Raw]
130+getExposed :: PkgInfo -> [ModuleName.Raw]
131getExposed info =
131getExposed info =
132 case _pkg_exposed info of
132 case _pkg_exposed info of
133 ExposedList modules ->
133 ExposedList modules ->
@@ -218,7 +218,7 @@ encodeExposed exposed =
218 E.object (map (fmap (E.list encodeModule)) chunks)
218 E.object (map (fmap (E.list encodeModule)) chunks)
219
219
220
220
221−encodeModule :: Module.Raw -> E.Value
221+encodeModule :: ModuleName.Raw -> E.Value
222encodeModule name =
222encodeModule name =
223 E.name name
223 E.name name
224
224
@@ -408,9 +408,9 @@ exposedDecoder =
408 ]
408 ]
409
409
410
410
411−moduleDecoder :: Decoder Module.Raw
411+moduleDecoder :: Decoder ModuleName.Raw
412moduleDecoder =
412moduleDecoder =
413− D.mapError E.BadModuleName Module.decoder
413+ D.mapError E.BadModuleName ModuleName.decoder
414
414
415
415
416checkHeader :: Text -> Decoder ()
416checkHeader :: Text -> Decoder ()
builder/src/Elm/Project/Summary.hs+12−12
@@ -12,10 +12,10 @@ module Elm.Project.Summary
12import Prelude hiding (init)
12import Prelude hiding (init)
13import qualified Data.List as List
13import qualified Data.List as List
14import qualified Data.Map as Map
14import qualified Data.Map as Map
15−import Data.Map (Map)
16
15
17−import qualified Elm.Compiler.Module as Module
16+import qualified Elm.Interface as I
17+import qualified Elm.ModuleName as ModuleName
18−import Elm.Package (Package(..), Name, Version)
18+import qualified Elm.Package as Pkg
19import Elm.Project.Json (Project(..), AppInfo(..), PkgInfo(..))
19import Elm.Project.Json (Project(..), AppInfo(..), PkgInfo(..))
20import qualified Elm.Project.Json as Project
20import qualified Elm.Project.Json as Project
21
21
@@ -29,24 +29,24 @@ data Summary =
29 { _root :: FilePath
29 { _root :: FilePath
30 , _project :: Project
30 , _project :: Project
31 , _exposed :: ExposedModules
31 , _exposed :: ExposedModules
32− , _ifaces :: Module.Interfaces
32+ , _ifaces :: I.Interfaces
33 , _depsGraph :: DepsGraph
33 , _depsGraph :: DepsGraph
34 }
34 }
35
35
36
36
37type ExposedModules =
37type ExposedModules =
38− Map.Map Module.Raw [Package]
38+ Map.Map ModuleName.Raw [Pkg.Canonical]
39
39
40
40
41type DepsGraph =
41type DepsGraph =
42− Map.Map Name ( Version, [Name] )
42+ Map.Map Pkg.Name ( Pkg.Version, [Pkg.Name] )
43
43
44
44
45
45
46-- MAKE SUMMARY
46-- MAKE SUMMARY
47
47
48
48
49−init :: FilePath -> Project -> Map Name PkgInfo -> Module.Interfaces -> Summary
49+init :: FilePath -> Project -> Map.Map Pkg.Name PkgInfo -> I.Interfaces -> Summary
50init root project deps ifaces =
50init root project deps ifaces =
51 let
51 let
52 exposed =
52 exposed =
@@ -66,8 +66,8 @@ init root project deps ifaces =
66 Summary root project exposed privatizedInterfaces depsGraph
66 Summary root project exposed privatizedInterfaces depsGraph
67
67
68
68
69−privatize :: ExposedModules -> Module.Canonical -> Module.Interface -> Maybe Module.Interface
69+privatize :: ExposedModules -> ModuleName.Canonical -> I.Interface -> Maybe I.Interface
70−privatize exposed (Module.Canonical _ name) iface =
70+privatize exposed (ModuleName.Canonical _ name) iface =
71 case Map.lookup name exposed of
71 case Map.lookup name exposed of
72 Just [_] ->
72 Just [_] ->
73 Just iface
73 Just iface
@@ -85,12 +85,12 @@ toNode (PkgInfo name _ _ version _ deps _ _) graph =
85-- MAKE CHEAP SUMMARY
85-- MAKE CHEAP SUMMARY
86
86
87
87
88−cheapInit :: FilePath -> PkgInfo -> Map Name PkgInfo -> Module.Interfaces -> Summary
88+cheapInit :: FilePath -> PkgInfo -> Map.Map Pkg.Name PkgInfo -> I.Interfaces -> Summary
89cheapInit root info deps ifaces =
89cheapInit root info deps ifaces =
90 Summary root (Pkg info) (getExposed deps (_pkg_deps info)) ifaces Map.empty
90 Summary root (Pkg info) (getExposed deps (_pkg_deps info)) ifaces Map.empty
91
91
92
92
93−getExposed :: Map Name PkgInfo -> Map Name a -> ExposedModules
93+getExposed :: Map.Map Pkg.Name PkgInfo -> Map.Map Pkg.Name a -> ExposedModules
94getExposed deps directs =
94getExposed deps directs =
95 Map.foldl insertExposed Map.empty (Map.intersection deps directs)
95 Map.foldl insertExposed Map.empty (Map.intersection deps directs)
96
96
@@ -99,7 +99,7 @@ insertExposed :: ExposedModules -> PkgInfo -> ExposedModules
99insertExposed exposed info =
99insertExposed exposed info =
100 let
100 let
101 home =
101 home =
102− Package (_pkg_name info) (_pkg_version info)
102+ Pkg.Canonical (_pkg_name info) (_pkg_version info)
103
103
104 insertModule dict modul =
104 insertModule dict modul =
105 Map.insertWith (++) modul [home] dict
105 Map.insertWith (++) modul [home] dict
builder/src/File/Args.hs+2−2
@@ -7,7 +7,7 @@ module File.Args
7 where
7 where
8
8
9
9
10−import qualified Elm.Compiler.Module as Module
10+import qualified Elm.ModuleName as ModuleName
11import qualified Elm.Project.Json as Project
11import qualified Elm.Project.Json as Project
12import qualified Elm.Project.Summary as Summary
12import qualified Elm.Project.Summary as Summary
13import qualified Reporting.Exit as Exit
13import qualified Reporting.Exit as Exit
@@ -16,7 +16,7 @@ import qualified Reporting.Task as Task
16
16
17
17
18data Args root
18data Args root
19− = Pkg [Module.Raw]
19+ = Pkg [ModuleName.Raw]
20 | Roots root [root]
20 | Roots root [root]
21
21
22
22
builder/src/File/Artifacts.hs+9−9
@@ -17,8 +17,8 @@ import qualified Data.Maybe as Maybe
17import qualified Data.Text.Encoding as Text
17import qualified Data.Text.Encoding as Text
18
18
19import qualified Elm.Compiler as Compiler
19import qualified Elm.Compiler as Compiler
20−import qualified Elm.Compiler.Module as Module
21import qualified Elm.Docs as Docs
20import qualified Elm.Docs as Docs
21+import qualified Elm.ModuleName as ModuleName
22import qualified Json.Encode as Encode
22import qualified Json.Encode as Encode
23
23
24import File.Compile (Answer(..))
24import File.Compile (Answer(..))
@@ -32,7 +32,7 @@ import qualified Stuff.Paths as Path
32-- IGNORE
32-- IGNORE
33
33
34
34
35−ignore :: Map Module.Raw Answer -> Task.Task (Map Module.Raw Compiler.Artifacts)
35+ignore :: Map ModuleName.Raw Answer -> Task.Task (Map ModuleName.Raw Compiler.Artifacts)
36ignore answers =
36ignore answers =
37 let
37 let
38 ignorer _name result =
38 ignorer _name result =
@@ -45,7 +45,7 @@ ignore answers =
45-- WRITE
45-- WRITE
46
46
47
47
48−write :: FilePath -> Map Module.Raw Answer -> Task.Task (Map Module.Raw Compiler.Artifacts)
48+write :: FilePath -> Map ModuleName.Raw Answer -> Task.Task (Map ModuleName.Raw Compiler.Artifacts)
49write root answers =
49write root answers =
50 let
50 let
51 writer name result@(Compiler.Artifacts elmi elmo _) =
51 writer name result@(Compiler.Artifacts elmi elmo _) =
@@ -60,7 +60,7 @@ write root answers =
60 liftIO $ traverse readMVar mvars
60 liftIO $ traverse readMVar mvars
61
61
62
62
63−writeDocs :: Map Module.Raw Compiler.Artifacts -> FilePath -> Task.Task Docs.Documentation
63+writeDocs :: Map ModuleName.Raw Compiler.Artifacts -> FilePath -> Task.Task Docs.Documentation
64writeDocs results path =
64writeDocs results path =
65 let
65 let
66 getDocs (Compiler.Artifacts _ _ docs) =
66 getDocs (Compiler.Artifacts _ _ docs) =
@@ -79,7 +79,7 @@ writeDocs results path =
79-- GATHER
79-- GATHER
80
80
81
81
82−gather :: OnGood a -> Map Module.Raw Answer -> Task.Task (Map Module.Raw a)
82+gather :: OnGood a -> Map ModuleName.Raw Answer -> Task.Task (Map ModuleName.Raw a)
83gather onGood answers =
83gather onGood answers =
84 do summary <- liftIO $
84 do summary <- liftIO $
85 foldM (gatherHelp onGood) (Right Map.empty) (Map.toList answers)
85 foldM (gatherHelp onGood) (Right Map.empty) (Map.toList answers)
@@ -92,10 +92,10 @@ gather onGood answers =
92 return results
92 return results
93
93
94
94
95−type OnGood a = Module.Raw -> Compiler.Artifacts -> IO a
95+type OnGood a = ModuleName.Raw -> Compiler.Artifacts -> IO a
96
96
97
97
98−gatherHelp :: OnGood a -> Summary a -> (Module.Raw, Answer) -> IO (Summary a)
98+gatherHelp :: OnGood a -> Summary a -> (ModuleName.Raw, Answer) -> IO (Summary a)
99gatherHelp onGood summary (name, answer) =
99gatherHelp onGood summary (name, answer) =
100 case answer of
100 case answer of
101 Blocked ->
101 Blocked ->
@@ -115,10 +115,10 @@ gatherHelp onGood summary (name, answer) =
115
115
116
116
117type Summary a =
117type Summary a =
118− Either (E.Exit, [E.Exit]) (Map Module.Raw a)
118+ Either (E.Exit, [E.Exit]) (Map ModuleName.Raw a)
119
119
120
120
121−addOk :: Module.Raw -> a -> Summary a -> Summary a
121+addOk :: ModuleName.Raw -> a -> Summary a -> Summary a
122addOk name result acc =
122addOk name result acc =
123 case acc of
123 case acc of
124 Left _ ->
124 Left _ ->
builder/src/File/Compile.hs+13−13
@@ -13,8 +13,8 @@ import qualified Data.Map as Map
13import qualified Data.Time.Clock as Time
13import qualified Data.Time.Clock as Time
14
14
15import qualified Elm.Compiler as Compiler
15import qualified Elm.Compiler as Compiler
16−import qualified Elm.Compiler.Module as Module
16+import qualified Elm.Interface as I
17−
17+import qualified Elm.ModuleName as ModuleName
18import Elm.Project.Json (Project)
18import Elm.Project.Json (Project)
19import qualified Elm.Project.Json as Project
19import qualified Elm.Project.Json as Project
20import qualified File.Plan as Plan
20import qualified File.Plan as Plan
@@ -26,7 +26,7 @@ import qualified Reporting.Task as Task
26-- COMPILE
26-- COMPILE
27
27
28
28
29−compile :: Project -> Maybe FilePath -> Module.Interfaces -> Dict Plan.Info -> Task.Task (Dict Answer)
29+compile :: Project -> Maybe FilePath -> I.Interfaces -> Dict Plan.Info -> Task.Task (Dict Answer)
30compile project maybeDocsPath ifaces modules =
30compile project maybeDocsPath ifaces modules =
31 do Task.report (Progress.CompileStart (Map.size modules))
31 do Task.report (Progress.CompileStart (Map.size modules))
32
32
@@ -54,7 +54,7 @@ data Answer
54 | Good Compiler.Artifacts
54 | Good Compiler.Artifacts
55
55
56
56
57−type Dict a = Map.Map Module.Raw a
57+type Dict a = Map.Map ModuleName.Raw a
58
58
59
59
60
60
@@ -66,8 +66,8 @@ compileModule
66 -> Project
66 -> Project
67 -> Maybe FilePath
67 -> Maybe FilePath
68 -> MVar (Dict (MVar Answer))
68 -> MVar (Dict (MVar Answer))
69− -> MVar Module.Interfaces
69+ -> MVar I.Interfaces
70− -> Module.Raw
70+ -> ModuleName.Raw
71 -> Plan.Info
71 -> Plan.Info
72 -> IO (MVar Answer)
72 -> IO (MVar Answer)
73compileModule tell project maybeDocsPath answersMVar ifacesMVar name info =
73compileModule tell project maybeDocsPath answersMVar ifacesMVar name info =
@@ -94,7 +94,7 @@ compileModule tell project maybeDocsPath answersMVar ifacesMVar name info =
94
94
95 (_warnings, Right result@(Compiler.Artifacts elmi _ _)) ->
95 (_warnings, Right result@(Compiler.Artifacts elmi _ _)) ->
96 do tell (Progress.CompileFileEnd name Progress.Good)
96 do tell (Progress.CompileFileEnd name Progress.Good)
97− let canonicalName = Module.Canonical pkg name
97+ let canonicalName = ModuleName.Canonical pkg name
98 lock <- takeMVar ifacesMVar
98 lock <- takeMVar ifacesMVar
99 putMVar ifacesMVar (Map.insert canonicalName elmi lock)
99 putMVar ifacesMVar (Map.insert canonicalName elmi lock)
100 putMVar mvar (Good result)
100 putMVar mvar (Good result)
@@ -106,7 +106,7 @@ compileModule tell project maybeDocsPath answersMVar ifacesMVar name info =
106-- TO DOCS FLAG
106-- TO DOCS FLAG
107
107
108
108
109−toDocsFlag :: Module.Raw -> Project -> Maybe FilePath -> Compiler.DocsFlag
109+toDocsFlag :: ModuleName.Raw -> Project -> Maybe FilePath -> Compiler.DocsFlag
110toDocsFlag name project maybeDocsPath =
110toDocsFlag name project maybeDocsPath =
111 case maybeDocsPath of
111 case maybeDocsPath of
112 Nothing ->
112 Nothing ->
@@ -124,7 +124,7 @@ toDocsFlag name project maybeDocsPath =
124 Compiler.NoDocs
124 Compiler.NoDocs
125
125
126
126
127−isExposed :: Module.Raw -> Project.Exposed -> Bool
127+isExposed :: ModuleName.Raw -> Project.Exposed -> Bool
128isExposed name exposed =
128isExposed name exposed =
129 case exposed of
129 case exposed of
130 Project.ExposedList modules ->
130 Project.ExposedList modules ->
@@ -138,16 +138,16 @@ isExposed name exposed =
138-- IMPORTS
138-- IMPORTS
139
139
140
140
141−makeImports :: Project -> Plan.Info -> Dict Module.Canonical
141+makeImports :: Project -> Plan.Info -> Dict ModuleName.Canonical
142makeImports project (Plan.Info _ _ _ clean dirty foreign) =
142makeImports project (Plan.Info _ _ _ clean dirty foreign) =
143 let
143 let
144 pkgName =
144 pkgName =
145 Project.getName project
145 Project.getName project
146
146
147 mkLocal name =
147 mkLocal name =
148− ( name, Module.Canonical pkgName name )
148+ ( name, ModuleName.Canonical pkgName name )
149
149
150− mkForeign canonicalName@(Module.Canonical _ name) =
150+ mkForeign canonicalName@(ModuleName.Canonical _ name) =
151 ( name, canonicalName )
151 ( name, canonicalName )
152 in
152 in
153 Map.fromList $
153 Map.fromList $
@@ -165,7 +165,7 @@ isBlocked answers info =
165 anyBlock <$> traverse (get answers) (Plan._dirty info)
165 anyBlock <$> traverse (get answers) (Plan._dirty info)
166
166
167
167
168−get :: Dict (MVar Answer) -> Module.Raw -> IO Answer
168+get :: Dict (MVar Answer) -> ModuleName.Raw -> IO Answer
169get names name =
169get names name =
170 case Map.lookup name names of
170 case Map.lookup name names of
171 Nothing ->
171 Nothing ->
builder/src/File/Crawl.hs+21−21
@@ -16,9 +16,9 @@ import qualified Data.Graph as Graph
16import qualified Data.Map as Map
16import qualified Data.Map as Map
17import qualified Data.Set as Set
17import qualified Data.Set as Set
18
18
19−import qualified Elm.Compiler.Module as Module
20import qualified Elm.Compiler.Objects as Obj
19import qualified Elm.Compiler.Objects as Obj
21import qualified Elm.Kernel as Kernel
20import qualified Elm.Kernel as Kernel
21+import qualified Elm.ModuleName as ModuleName
22import qualified Elm.Package as Pkg
22import qualified Elm.Package as Pkg
23
23
24import qualified Elm.Project.Json as Project
24import qualified Elm.Project.Json as Project
@@ -38,10 +38,10 @@ import qualified Reporting.Task as Task
38
38
39data Graph kernel problems =
39data Graph kernel problems =
40 Graph
40 Graph
41− { _args :: Args.Args Module.Raw
41+ { _args :: Args.Args ModuleName.Raw
42− , _locals :: Map.Map Module.Raw Header.Info
42+ , _locals :: Map.Map ModuleName.Raw Header.Info
43− , _kernels :: Map.Map Module.Raw kernel
43+ , _kernels :: Map.Map ModuleName.Raw kernel
44− , _foreigns :: Map.Map Module.Raw Pkg.Package
44+ , _foreigns :: Map.Map ModuleName.Raw Pkg.Canonical
45 , _problems :: problems
45 , _problems :: problems
46 }
46 }
47
47
@@ -54,7 +54,7 @@ type WorkGraph =
54 Graph (FilePath, Maybe FilePath) [E.Problem]
54 Graph (FilePath, Maybe FilePath) [E.Problem]
55
55
56
56
57−initWorkGraph :: Args.Args Module.Raw -> Map.Map Module.Raw Header.Info -> WorkGraph
57+initWorkGraph :: Args.Args ModuleName.Raw -> Map.Map ModuleName.Raw Header.Info -> WorkGraph
58initWorkGraph args locals =
58initWorkGraph args locals =
59 Graph args locals Map.empty Map.empty []
59 Graph args locals Map.empty Map.empty []
60
60
@@ -90,7 +90,7 @@ crawlFromSource summary@(Summary _ project _ _ _) source =
90 Header.readSource project source
90 Header.readSource project source
91
91
92
92
93−crawlHelp :: Summary -> ( Maybe Module.Raw, Header.Info ) -> Task.Task Result
93+crawlHelp :: Summary -> ( Maybe ModuleName.Raw, Header.Info ) -> Task.Task Result
94crawlHelp summary ( maybeName, info@(Header.Info path _ _ deps) ) =
94crawlHelp summary ( maybeName, info@(Header.Info path _ _ deps) ) =
95 do let name = maybe "Main" id maybeName
95 do let name = maybe "Main" id maybeName
96 let toUnvisited dep = Unvisited (maybe (E.File path) (E.Module path) maybeName) dep
96 let toUnvisited dep = Unvisited (maybe (E.File path) (E.Module path) maybeName) dep
@@ -124,7 +124,7 @@ depthFirstSearch summary unvisited startGraph =
124-- CHECK FOR CYCLES
124-- CHECK FOR CYCLES
125
125
126
126
127−checkForCycles :: Map.Map Module.Raw Header.Info -> Task.Task ()
127+checkForCycles :: Map.Map ModuleName.Raw Header.Info -> Task.Task ()
128checkForCycles locals =
128checkForCycles locals =
129 let
129 let
130 toNode (name, Header.Info _ _ _ imports) =
130 toNode (name, Header.Info _ _ _ imports) =
@@ -136,7 +136,7 @@ checkForCycles locals =
136 mapM_ checkComponent components
136 mapM_ checkComponent components
137
137
138
138
139−checkComponent :: Graph.SCC Module.Raw -> Task.Task ()
139+checkComponent :: Graph.SCC ModuleName.Raw -> Task.Task ()
140checkComponent scc =
140checkComponent scc =
141 case scc of
141 case scc of
142 Graph.AcyclicSCC _ ->
142 Graph.AcyclicSCC _ ->
@@ -154,7 +154,7 @@ dfs
154 :: Summary
154 :: Summary
155 -> Chan (Either E.Problem Asset)
155 -> Chan (Either E.Problem Asset)
156 -> Int
156 -> Int
157− -> Set.Set Module.Raw
157+ -> Set.Set ModuleName.Raw
158 -> [Unvisited]
158 -> [Unvisited]
159 -> WorkGraph
159 -> WorkGraph
160 -> Task.Task WorkGraph
160 -> Task.Task WorkGraph
@@ -194,9 +194,9 @@ dfs summary chan oldPending oldSeen unvisited graph =
194spawnVisitor
194spawnVisitor
195 :: Summary
195 :: Summary
196 -> Chan (Either E.Problem Asset)
196 -> Chan (Either E.Problem Asset)
197− -> (Set.Set Module.Raw, Int)
197+ -> (Set.Set ModuleName.Raw, Int)
198 -> Unvisited
198 -> Unvisited
199− -> Task.Task (Set.Set Module.Raw, Int)
199+ -> Task.Task (Set.Set ModuleName.Raw, Int)
200spawnVisitor summary chan (seen, n) unvisited@(Unvisited _ name) =
200spawnVisitor summary chan (seen, n) unvisited@(Unvisited _ name) =
201 if Set.member name seen then
201 if Set.member name seen then
202 return (seen, n)
202 return (seen, n)
@@ -212,14 +212,14 @@ spawnVisitor summary chan (seen, n) unvisited@(Unvisited _ name) =
212data Unvisited =
212data Unvisited =
213 Unvisited
213 Unvisited
214 { _origin :: E.Origin
214 { _origin :: E.Origin
215− , _name :: Module.Raw
215+ , _name :: ModuleName.Raw
216 }
216 }
217
217
218
218
219data Asset
219data Asset
220− = Local Module.Raw Header.Info
220+ = Local ModuleName.Raw Header.Info
221− | Kernel Module.Raw (FilePath, Maybe FilePath)
221+ | Kernel ModuleName.Raw (FilePath, Maybe FilePath)
222− | Foreign Module.Raw Pkg.Package
222+ | Foreign ModuleName.Raw Pkg.Canonical
223 | ForeignKernel
223 | ForeignKernel
224
224
225
225
@@ -246,9 +246,9 @@ toVisitor summary (Unvisited origin name) =
246
246
247visitKernels
247visitKernels
248 :: Summary
248 :: Summary
249− -> Map.Map Module.Raw Header.Info
249+ -> Map.Map ModuleName.Raw Header.Info
250− -> Map.Map Module.Raw (FilePath, Maybe FilePath)
250+ -> Map.Map ModuleName.Raw (FilePath, Maybe FilePath)
251− -> Task.Task (Map.Map Module.Raw Obj.Kernel)
251+ -> Task.Task (Map.Map ModuleName.Raw Obj.Kernel)
252visitKernels summary locals kernelPaths =
252visitKernels summary locals kernelPaths =
253 if Map.null kernelPaths then
253 if Map.null kernelPaths then
254 return Map.empty
254 return Map.empty
@@ -281,10 +281,10 @@ readKContent importDict path =
281
281
282
282
283type ImportDict =
283type ImportDict =
284− Map.Map Module.Raw [Pkg.Name]
284+ Map.Map ModuleName.Raw [Pkg.Name]
285
285
286
286
287−toImportDict :: Summary -> Map.Map Module.Raw info -> ImportDict
287+toImportDict :: Summary -> Map.Map ModuleName.Raw info -> ImportDict
288toImportDict (Summary _ project exposed _ _) locals =
288toImportDict (Summary _ project exposed _ _) locals =
289 let
289 let
290 localPkg =
290 localPkg =
builder/src/File/Find.hs+10−10
@@ -14,7 +14,7 @@ import qualified System.FilePath as FP
14import qualified System.Directory as Dir
14import qualified System.Directory as Dir
15import System.FilePath ((</>), (<.>))
15import System.FilePath ((</>), (<.>))
16
16
17−import qualified Elm.Compiler.Module as Module
17+import qualified Elm.ModuleName as ModuleName
18import qualified Elm.Package as Pkg
18import qualified Elm.Package as Pkg
19
19
20import qualified Elm.Project.Json as Project
20import qualified Elm.Project.Json as Project
@@ -30,7 +30,7 @@ import qualified Reporting.Task as Task
30data Asset
30data Asset
31 = Local FilePath
31 = Local FilePath
32 | Kernel FilePath (Maybe FilePath)
32 | Kernel FilePath (Maybe FilePath)
33− | Foreign Pkg.Package
33+ | Foreign Pkg.Canonical
34 | ForeignKernel
34 | ForeignKernel
35
35
36
36
@@ -38,7 +38,7 @@ data Asset
38-- FIND
38-- FIND
39
39
40
40
41−find :: Summary.Summary -> E.Origin -> Module.Raw -> Task.Task_ E.Problem Asset
41+find :: Summary.Summary -> E.Origin -> ModuleName.Raw -> Task.Task_ E.Problem Asset
42find (Summary.Summary root project exposed _ _) origin name =
42find (Summary.Summary root project exposed _ _) origin name =
43 do here <- liftIO Dir.getCurrentDirectory
43 do here <- liftIO Dir.getCurrentDirectory
44 let toRoot dir = FP.makeRelative here (root </> dir)
44 let toRoot dir = FP.makeRelative here (root </> dir)
@@ -62,7 +62,7 @@ find (Summary.Summary root project exposed _ _) origin name =
62-- FIND ELM
62-- FIND ELM
63
63
64
64
65−findElm :: Project.Project -> [FilePath] -> Summary.ExposedModules -> E.Origin -> Module.Raw -> Task.Task_ E.Problem Asset
65+findElm :: Project.Project -> [FilePath] -> Summary.ExposedModules -> E.Origin -> ModuleName.Raw -> Task.Task_ E.Problem Asset
66findElm project srcDirs exposed origin name =
66findElm project srcDirs exposed origin name =
67 do
67 do
68 paths <- liftIO $ Maybe.catMaybes <$> mapM (elmExists name) srcDirs
68 paths <- liftIO $ Maybe.catMaybes <$> mapM (elmExists name) srcDirs
@@ -86,9 +86,9 @@ findElm project srcDirs exposed origin name =
86 Task.throw $ E.ModuleAmbiguous origin name paths (maybe [] id maybePkgs)
86 Task.throw $ E.ModuleAmbiguous origin name paths (maybe [] id maybePkgs)
87
87
88
88
89−elmExists :: Module.Raw -> FilePath -> IO (Maybe FilePath)
89+elmExists :: ModuleName.Raw -> FilePath -> IO (Maybe FilePath)
90elmExists name srcDir =
90elmExists name srcDir =
91− do let path = srcDir </> Module.nameToSlashPath name <.> "elm"
91+ do let path = srcDir </> ModuleName.nameToSlashPath name <.> "elm"
92 exists <- Dir.doesFileExist path
92 exists <- Dir.doesFileExist path
93 return $ if exists then Just path else Nothing
93 return $ if exists then Just path else Nothing
94
94
@@ -97,17 +97,17 @@ elmExists name srcDir =
97-- FIND KERNEL
97-- FIND KERNEL
98
98
99
99
100−findKernel :: FilePath -> Summary.ExposedModules -> E.Origin -> Module.Raw -> Task.Task_ E.Problem Asset
100+findKernel :: FilePath -> Summary.ExposedModules -> E.Origin -> ModuleName.Raw -> Task.Task_ E.Problem Asset
101findKernel srcDir exposed origin name =
101findKernel srcDir exposed origin name =
102− do let clientPath = srcDir </> Module.nameToSlashPath name <.> "js"
102+ do let clientPath = srcDir </> ModuleName.nameToSlashPath name <.> "js"
103− let serverPath = srcDir </> Module.nameToSlashPath name <.> "server.js"
103+ let serverPath = srcDir </> ModuleName.nameToSlashPath name <.> "server.js"
104 client <- liftIO $ Dir.doesFileExist clientPath
104 client <- liftIO $ Dir.doesFileExist clientPath
105 server <- liftIO $ Dir.doesFileExist serverPath
105 server <- liftIO $ Dir.doesFileExist serverPath
106 if client
106 if client
107 then return $ Kernel clientPath (if server then Just serverPath else Nothing)
107 then return $ Kernel clientPath (if server then Just serverPath else Nothing)
108 else
108 else
109 case Map.lookup (Name.getKernel name) exposed of
109 case Map.lookup (Name.getKernel name) exposed of
110− Just [Pkg.Package pkg _vsn] | pkg == Pkg.core || pkg == Pkg.virtualDom ->
110+ Just [Pkg.Canonical pkg _vsn] | pkg == Pkg.core || pkg == Pkg.virtualDom ->
111 return ForeignKernel
111 return ForeignKernel
112
112
113 _ ->
113 _ ->
builder/src/File/Header.hs+11−12
@@ -16,9 +16,8 @@ import qualified Data.Time.Calendar as Day
16import qualified Data.Time.Clock as Time
16import qualified Data.Time.Clock as Time
17import qualified System.Directory as Dir
17import qualified System.Directory as Dir
18
18
19−import qualified Elm.Compiler.Module as Module
20import qualified Elm.Header as Header
19import qualified Elm.Header as Header
21−
20+import qualified Elm.ModuleName as ModuleName
22import qualified Elm.Project.Json as Project
21import qualified Elm.Project.Json as Project
23import Elm.Project.Json (Project)
22import Elm.Project.Json (Project)
24import Elm.Project.Summary (Summary(..))
23import Elm.Project.Summary (Summary(..))
@@ -37,7 +36,7 @@ data Info =
37 { _path :: FilePath
36 { _path :: FilePath
38 , _time :: Time.UTCTime
37 , _time :: Time.UTCTime
39 , _source :: BS.ByteString
38 , _source :: BS.ByteString
40− , _imports :: [Module.Raw]
39+ , _imports :: [ModuleName.Raw]
41 }
40 }
42
41
43
42
@@ -49,7 +48,7 @@ atRoot task =
49-- READ MODULE
48-- READ MODULE
50
49
51
50
52−readModule :: Summary -> Module.Raw -> FilePath -> Task.Task_ E.Problem (Module.Raw, Info)
51+readModule :: Summary -> ModuleName.Raw -> FilePath -> Task.Task_ E.Problem (ModuleName.Raw, Info)
53readModule summary expectedName path =
52readModule summary expectedName path =
54 do time <- liftIO $ Dir.getModificationTime path
53 do time <- liftIO $ Dir.getModificationTime path
55 source <- liftIO $ IO.readUtf8 path
54 source <- liftIO $ IO.readUtf8 path
@@ -58,7 +57,7 @@ readModule summary expectedName path =
58 return (name, info)
57 return (name, info)
59
58
60
59
61−checkName :: FilePath -> Module.Raw -> Maybe Module.Raw -> Task.Task_ E.Problem Module.Raw
60+checkName :: FilePath -> ModuleName.Raw -> Maybe ModuleName.Raw -> Task.Task_ E.Problem ModuleName.Raw
62checkName path expectedName maybeName =
61checkName path expectedName maybeName =
63 case maybeName of
62 case maybeName of
64 Nothing ->
63 Nothing ->
@@ -74,7 +73,7 @@ checkName path expectedName maybeName =
74-- READ ONE FILE
73-- READ ONE FILE
75
74
76
75
77−readOneFile :: Summary -> FilePath -> Task.Task (Maybe Module.Raw, Info)
76+readOneFile :: Summary -> FilePath -> Task.Task (Maybe ModuleName.Raw, Info)
78readOneFile summary path =
77readOneFile summary path =
79 Task.mapError Exit.Crawl $
78 Task.mapError Exit.Crawl $
80 do (time, source) <- readOneHelp path
79 do (time, source) <- readOneHelp path
@@ -93,7 +92,7 @@ readOneHelp path =
93-- READ MANY FILES
92-- READ MANY FILES
94
93
95
94
96−readManyFiles :: Summary -> FilePath -> [FilePath] -> Task.Task ((Module.Raw, Info), [(Module.Raw, Info)])
95+readManyFiles :: Summary -> FilePath -> [FilePath] -> Task.Task ((ModuleName.Raw, Info), [(ModuleName.Raw, Info)])
97readManyFiles summary file files =
96readManyFiles summary file files =
98 Task.mapError Exit.Crawl $
97 Task.mapError Exit.Crawl $
99 do info <- readManyFilesHelp summary file
98 do info <- readManyFilesHelp summary file
@@ -106,7 +105,7 @@ readManyFiles summary file files =
106 insert (k,v) dict = Map.insertWith append k (v, []) dict
105 insert (k,v) dict = Map.insertWith append k (v, []) dict
107
106
108
107
109−readManyFilesHelp :: Summary -> FilePath -> Task.Task_ E.Exit (Module.Raw, Info)
108+readManyFilesHelp :: Summary -> FilePath -> Task.Task_ E.Exit (ModuleName.Raw, Info)
110readManyFilesHelp summary path =
109readManyFilesHelp summary path =
111 do (time, source) <- readOneHelp path
110 do (time, source) <- readOneHelp path
112 (maybeName, info) <- atRoot $ parse (_project summary) path time source
111 (maybeName, info) <- atRoot $ parse (_project summary) path time source
@@ -118,7 +117,7 @@ readManyFilesHelp summary path =
118 return (name, info)
117 return (name, info)
119
118
120
119
121−detectDuplicateNames :: Module.Raw -> (Info, [Info]) -> Task.Task_ E.Exit ()
120+detectDuplicateNames :: ModuleName.Raw -> (Info, [Info]) -> Task.Task_ E.Exit ()
122detectDuplicateNames name (info, otherInfos) =
121detectDuplicateNames name (info, otherInfos) =
123 case otherInfos of
122 case otherInfos of
124 [] ->
123 [] ->
@@ -133,7 +132,7 @@ detectDuplicateNames name (info, otherInfos) =
133-- READ SOURCE
132-- READ SOURCE
134
133
135
134
136−readSource :: Project -> BS.ByteString -> Task.Task (Maybe Module.Raw, Info)
135+readSource :: Project -> BS.ByteString -> Task.Task (Maybe ModuleName.Raw, Info)
137readSource project source =
136readSource project source =
138 Task.mapError Exit.Crawl $
137 Task.mapError Exit.Crawl $
139 atRoot $ parse project "elm" fakeTime source
138 atRoot $ parse project "elm" fakeTime source
@@ -148,7 +147,7 @@ fakeTime =
148-- PARSE HEADER
147-- PARSE HEADER
149
148
150
149
151−parse :: Project -> FilePath -> Time.UTCTime -> BS.ByteString -> Task.Task_ E.Problem (Maybe Module.Raw, Info)
150+parse :: Project -> FilePath -> Time.UTCTime -> BS.ByteString -> Task.Task_ E.Problem (Maybe ModuleName.Raw, Info)
152parse project path time source =
151parse project path time source =
153 -- TODO get regions on data extracted here
152 -- TODO get regions on data extracted here
154 case Header.parse (Project.getName project) source of
153 case Header.parse (Project.getName project) source of
@@ -160,7 +159,7 @@ parse project path time source =
160 Task.throw (E.BadHeader path time source msg)
159 Task.throw (E.BadHeader path time source msg)
161
160
162
161
163−checkTag :: Project -> FilePath -> Maybe (Header.Tag, Module.Raw) -> Task.Task_ E.Problem (Maybe Module.Raw)
162+checkTag :: Project -> FilePath -> Maybe (Header.Tag, ModuleName.Raw) -> Task.Task_ E.Problem (Maybe ModuleName.Raw)
164checkTag project path maybeDecl =
163checkTag project path maybeDecl =
165 case maybeDecl of
164 case maybeDecl of
166 Nothing ->
165 Nothing ->
builder/src/File/Plan.hs+15−15
@@ -17,9 +17,9 @@ import qualified Data.Map as Map
17import qualified Data.Time.Clock as Time
17import qualified Data.Time.Clock as Time
18import qualified System.Directory as Dir
18import qualified System.Directory as Dir
19
19
20−import qualified Elm.Compiler.Module as Module
20+import qualified Elm.Interface as I
21+import qualified Elm.ModuleName as ModuleName
21import qualified Elm.Package as Pkg
22import qualified Elm.Package as Pkg
22−
23import qualified Elm.Project.Json as Project
23import qualified Elm.Project.Json as Project
24import qualified Elm.Project.Summary as Summary
24import qualified Elm.Project.Summary as Summary
25import qualified File.Crawl as Crawl
25import qualified File.Crawl as Crawl
@@ -32,10 +32,10 @@ import qualified Stuff.Paths
32-- PLAN
32-- PLAN
33
33
34
34
35−type Dict value = Map.Map Module.Raw value
35+type Dict value = Map.Map ModuleName.Raw value
36
36
37
37
38−plan :: Maybe FilePath -> Summary.Summary -> Crawl.Result -> Task.Task (Dict Info, Module.Interfaces)
38+plan :: Maybe FilePath -> Summary.Summary -> Crawl.Result -> Task.Task (Dict Info, I.Interfaces)
39plan docs (Summary.Summary root project _ ifaces _) (Crawl.Graph _ locals _ foreigns _) =
39plan docs (Summary.Summary root project _ ifaces _) (Crawl.Graph _ locals _ foreigns _) =
40 liftIO $
40 liftIO $
41 do queue <- newChan
41 do queue <- newChan
@@ -75,9 +75,9 @@ data Info =
75 { _path :: FilePath
75 { _path :: FilePath
76 , _time :: Time.UTCTime
76 , _time :: Time.UTCTime
77 , _src :: BS.ByteString
77 , _src :: BS.ByteString
78− , _clean :: [Module.Raw]
78+ , _clean :: [ModuleName.Raw]
79− , _dirty :: [Module.Raw]
79+ , _dirty :: [ModuleName.Raw]
80− , _foreign :: [Module.Canonical] -- TODO is this needed?
80+ , _foreign :: [ModuleName.Canonical] -- TODO is this needed?
81 }
81 }
82
82
83
83
@@ -88,8 +88,8 @@ data Info =
88getStatus
88getStatus
89 :: Env
89 :: Env
90 -> MVar (Dict (MVar Status))
90 -> MVar (Dict (MVar Status))
91− -> Dict Pkg.Package
91+ -> Dict Pkg.Canonical
92− -> Module.Raw
92+ -> ModuleName.Raw
93 -> Header.Info
93 -> Header.Info
94 -> IO (MVar Status)
94 -> IO (MVar Status)
95getStatus env statusMVars foreigns name (Header.Info path time src deps) =
95getStatus env statusMVars foreigns name (Header.Info path time src deps) =
@@ -117,7 +117,7 @@ getStatus env statusMVars foreigns name (Header.Info path time src deps) =
117
117
118 if name /= "Main" && freshElmi && freshDocs
118 if name /= "Main" && freshElmi && freshDocs
119 then
119 then
120− do let canonical = Module.Canonical (_pkg env) name
120+ do let canonical = ModuleName.Canonical (_pkg env) name
121 writeChan (_queue env) (Get canonical elmi)
121 writeChan (_queue env) (Get canonical elmi)
122 return Nothing
122 return Nothing
123 else
123 else
@@ -128,7 +128,7 @@ getStatus env statusMVars foreigns name (Header.Info path time src deps) =
128 return mvar
128 return mvar
129
129
130
130
131−addDep :: Dict (MVar Status) -> Dict Pkg.Package -> Info -> Module.Raw -> IO Info
131+addDep :: Dict (MVar Status) -> Dict Pkg.Canonical -> Info -> ModuleName.Raw -> IO Info
132addDep locals foreigns info name =
132addDep locals foreigns info name =
133 case Map.lookup name locals of
133 case Map.lookup name locals of
134 Just mvar ->
134 Just mvar ->
@@ -142,8 +142,8 @@ addDep locals foreigns info name =
142
142
143 Nothing ->
143 Nothing ->
144 case Map.lookup name foreigns of
144 case Map.lookup name foreigns of
145− Just (Pkg.Package pkg _vsn) ->
145+ Just (Pkg.Canonical pkg _vsn) ->
146− return $ info { _foreign = Module.Canonical pkg name : _foreign info }
146+ return $ info { _foreign = ModuleName.Canonical pkg name : _foreign info }
147
147
148 Nothing ->
148 Nothing ->
149 return info -- must be native
149 return info -- must be native
@@ -185,10 +185,10 @@ remove path =
185
185
186data Msg
186data Msg
187 = EndLoop (Dict Info)
187 = EndLoop (Dict Info)
188− | Get Module.Canonical FilePath
188+ | Get ModuleName.Canonical FilePath
189
189
190
190
191−ifaceLoader :: Chan Msg -> Module.Interfaces -> IO (Dict Info, Module.Interfaces)
191+ifaceLoader :: Chan Msg -> I.Interfaces -> IO (Dict Info, I.Interfaces)
192ifaceLoader queue ifaces =
192ifaceLoader queue ifaces =
193 do msg <- readChan queue
193 do msg <- readChan queue
194 case msg of
194 case msg of
builder/src/Generate/Nitpick.hs+1−1
@@ -9,7 +9,7 @@ import qualified Data.Name as Name
9import qualified Data.Set as Set
9import qualified Data.Set as Set
10
10
11import qualified AST.Optimized as Opt
11import qualified AST.Optimized as Opt
12−import qualified AST.Module.Name as ModuleName
12+import qualified Elm.ModuleName as ModuleName
13import qualified Elm.Package as Pkg
13import qualified Elm.Package as Pkg
14
14
15
15
builder/src/Generate/Output.hs+8−10
@@ -23,12 +23,10 @@ import qualified System.FilePath as FP
23import System.FilePath ((</>))
23import System.FilePath ((</>))
24
24
25import qualified Elm.Compiler as Compiler
25import qualified Elm.Compiler as Compiler
26−import qualified Elm.Compiler.Module as Module
27import qualified Elm.Compiler.Objects as Obj
26import qualified Elm.Compiler.Objects as Obj
28import qualified Elm.Interface as I
27import qualified Elm.Interface as I
28+import qualified Elm.ModuleName as ModuleName
29import qualified Elm.Package as Pkg
29import qualified Elm.Package as Pkg
30−
31−import qualified AST.Module.Name as ModuleName
32import qualified Elm.Project.Json as Project
30import qualified Elm.Project.Json as Project
33import qualified Elm.Project.Summary as Summary
31import qualified Elm.Project.Summary as Summary
34import qualified File.Args as Args
32import qualified File.Args as Args
@@ -59,7 +57,7 @@ generate
59 -> Maybe Output
57 -> Maybe Output
60 -> Summary.Summary
58 -> Summary.Summary
61 -> Crawl.Result
59 -> Crawl.Result
62− -> Map.Map Module.Raw Compiler.Artifacts
60+ -> Map.Map ModuleName.Raw Compiler.Artifacts
63 -> Task.Task ()
61 -> Task.Task ()
64generate mode target maybeOutput summary graph@(Crawl.Graph args locals _ _ _) artifacts =
62generate mode target maybeOutput summary graph@(Crawl.Graph args locals _ _ _) artifacts =
65 case args of
63 case args of
@@ -87,8 +85,8 @@ generate mode target maybeOutput summary graph@(Crawl.Graph args locals _ _ _) a
87
85
88getInterfaces
86getInterfaces
89 :: Summary.Summary
87 :: Summary.Summary
90− -> Map.Map Module.Raw a
88+ -> Map.Map ModuleName.Raw a
91− -> Map.Map Module.Raw Compiler.Artifacts
89+ -> Map.Map ModuleName.Raw Compiler.Artifacts
92 -> Task.Task I.Interfaces
90 -> Task.Task I.Interfaces
93getInterfaces (Summary.Summary root project _ interfaces _) locals artifacts =
91getInterfaces (Summary.Summary root project _ interfaces _) locals artifacts =
94 let
92 let
@@ -119,11 +117,11 @@ generateMonolith
119 -> Maybe Output
117 -> Maybe Output
120 -> Summary.Summary
118 -> Summary.Summary
121 -> Obj.Graph
119 -> Obj.Graph
122− -> [Module.Raw]
120+ -> [ModuleName.Raw]
123 -> Task.Task ()
121 -> Task.Task ()
124generateMonolith mode maybeOutput (Summary.Summary _ project _ _ _) graph rootNames =
122generateMonolith mode maybeOutput (Summary.Summary _ project _ _ _) graph rootNames =
125 do let pkg = Project.getName project
123 do let pkg = Project.getName project
126− let roots = map (Module.Canonical pkg) rootNames
124+ let roots = map (ModuleName.Canonical pkg) rootNames
127 case Obj.generate mode graph roots of
125 case Obj.generate mode graph roots of
128 Obj.None ->
126 Obj.None ->
129 return ()
127 return ()
@@ -172,7 +170,7 @@ generateReplFile noColors localizer summary@(Summary.Summary _ project _ _ _) gr
172 do
170 do
173 objectGraph <- organize summary graph
171 objectGraph <- organize summary graph
174
172
175− let home = Module.Canonical (Project.getName project) Name.replModule
173+ let home = ModuleName.Canonical (Project.getName project) Name.replModule
176 let builder = Obj.generateForRepl (not noColors) localizer objectGraph iface home name
174 let builder = Obj.generateForRepl (not noColors) localizer objectGraph iface home name
177
175
178 liftIO $ IO.writeBuilder (Paths.temp "js") $
176 liftIO $ IO.writeBuilder (Paths.temp "js") $
@@ -197,7 +195,7 @@ organize (Summary.Summary root _ _ _ deps) (Crawl.Graph _ locals _ _ _) =
197 return (Obj.union localObjs foreignObjs)
195 return (Obj.union localObjs foreignObjs)
198
196
199
197
200−loadModuleObj :: FilePath -> Module.Raw -> Task.Task Obj.Graph
198+loadModuleObj :: FilePath -> ModuleName.Raw -> Task.Task Obj.Graph
201loadModuleObj root name =
199loadModuleObj root name =
202 IO.readBinary (Paths.elmo root name)
200 IO.readBinary (Paths.elmo root name)
203
201
builder/src/Reporting/Exit.hs+2−2
@@ -8,7 +8,7 @@ module Reporting.Exit
8 where
8 where
9
9
10
10
11−import qualified Elm.Compiler.Module as Module
11+import qualified Elm.ModuleName as ModuleName
12import qualified Json.Encode as Encode
12import qualified Json.Encode as Encode
13import qualified Reporting.Doc as D
13import qualified Reporting.Doc as D
14import qualified Reporting.Exit.Assets as Asset
14import qualified Reporting.Exit.Assets as Asset
@@ -35,7 +35,7 @@ data Exit
35 | Bump Bump.Exit
35 | Bump Bump.Exit
36 | Compile Compile.Exit [Compile.Exit]
36 | Compile Compile.Exit [Compile.Exit]
37 | Crawl Crawl.Exit
37 | Crawl Crawl.Exit
38− | Cycle [Module.Raw] -- TODO write docs to help with this scenario
38+ | Cycle [ModuleName.Raw] -- TODO write docs to help with this scenario
39 | Deps Deps.Exit
39 | Deps Deps.Exit
40 | Diff Diff.Exit
40 | Diff Diff.Exit
41 | Make Make.Exit
41 | Make Make.Exit
builder/src/Reporting/Exit/Compile.hs+5−5
@@ -13,7 +13,7 @@ import qualified Data.Text as Text
13import qualified Data.Time.Clock as Time
13import qualified Data.Time.Clock as Time
14
14
15import qualified Elm.Compiler as Compiler
15import qualified Elm.Compiler as Compiler
16−import qualified Elm.Compiler.Module as Module
16+import qualified Elm.ModuleName as ModuleName
17import qualified Json.Encode as Encode
17import qualified Json.Encode as Encode
18import qualified Reporting.Doc as D
18import qualified Reporting.Doc as D
19
19
@@ -24,7 +24,7 @@ import qualified Reporting.Doc as D
24
24
25data Exit =
25data Exit =
26 Exit
26 Exit
27− { _name :: Module.Raw
27+ { _name :: ModuleName.Raw
28 , _path :: FilePath
28 , _path :: FilePath
29 , _time :: Time.UTCTime
29 , _time :: Time.UTCTime
30 , _source :: Text.Text
30 , _source :: Text.Text
@@ -68,11 +68,11 @@ exitToDoc (Exit _name path _time source errors) =
68 Compiler.errorsToDoc path source errors
68 Compiler.errorsToDoc path source errors
69
69
70
70
71−separator :: Module.Raw -> Module.Raw -> D.Doc
71+separator :: ModuleName.Raw -> ModuleName.Raw -> D.Doc
72separator beforeName afterName =
72separator beforeName afterName =
73 let
73 let
74− before = Module.nameToString beforeName ++ " ↑ "
74+ before = ModuleName.nameToString beforeName ++ " ↑ "
75− after = " ↓ " ++ Module.nameToString afterName
75+ after = " ↓ " ++ ModuleName.nameToString afterName
76 in
76 in
77 D.dullred $ D.vcat $
77 D.dullred $ D.vcat $
78 [ D.indent (80 - length before) (D.fromString before)
78 [ D.indent (80 - length before) (D.fromString before)
builder/src/Reporting/Exit/Crawl.hs+36−36
@@ -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
17
17
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
30
30
31data Exit
31data Exit
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
37
37
38
38
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
46 FilePath
46 FilePath
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
51
51
52
52
53data Origin
53data Origin
54 = ElmJson
54 = ElmJson
55 | File FilePath
55 | File FilePath
56− | Module FilePath Module.Raw
56+ | Module FilePath ModuleName.Raw
57
57
58
58
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!"
88 ]
88 ]
@@ -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:"
141 )
141 )
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!"
146 ]
146 ]
147
147
@@ -159,7 +159,7 @@ problemToReport problem =
159 \ cautious in expanding its usage."
159 \ cautious in expanding its usage."
160
160
161
161
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."
174 ]
174 ]
175 , D.toSimpleNote $
175 , D.toSimpleNote $
@@ -182,14 +182,14 @@ badTagToDoc path name tag hintName summary =
182-- NAMELESS
182-- NAMELESS
183
183
184
184
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:"
190 )
190 )
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
205
205
206
206
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."
216 ]
216 ]
217
217
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)
222
222
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)
227
227
228
228
229−notFoundDetails :: Module.Raw -> SrcDirs -> [D.Doc]
229+notFoundDetails :: ModuleName.Raw -> SrcDirs -> [D.Doc]
230notFoundDetails child srcDirs =
230notFoundDetails child srcDirs =
231 let
231 let
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
234 in
234 in
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 =
243 Pkg ->
243 Pkg ->
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."
248
248
249 App _ ->
249 App _ ->
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."
254 ]
254 ]
255
255
@@ -275,10 +275,10 @@ notFoundDetails child srcDirs =
275 ]
275 ]
276
276
277
277
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 =
280 let
280 let
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
283
283
284 makeReport maybePath summary yellowString =
284 makeReport maybePath summary yellowString =
@@ -303,22 +303,22 @@ ambiguousToDoc origin child paths pkgs =
303 makeReport
303 makeReport
304 Nothing
304 Nothing
305 "Your elm.json wants the following module:"
305 "Your elm.json wants the following module:"
306− (Module.nameToString child)
306+ (ModuleName.nameToString child)
307
307
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)
313
313
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)
319
319
320
320
321−kernelNameToDoc :: Origin -> Module.Raw -> Help.Report
321+kernelNameToDoc :: Origin -> ModuleName.Raw -> Help.Report
322kernelNameToDoc origin kernelName =
322kernelNameToDoc origin kernelName =
323 let
323 let
324 (maybePath, statement) =
324 (maybePath, statement) =
@@ -335,11 +335,11 @@ kernelNameToDoc origin kernelName =
335
335
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:"
339 )
339 )
340 in
340 in
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."
builder/src/Reporting/Exit/Make.hs+3−3
@@ -6,7 +6,7 @@ module Reporting.Exit.Make
6 where
6 where
7
7
8
8
9−import qualified Elm.Compiler.Module as Module
9+import qualified Elm.ModuleName as ModuleName
10import qualified Reporting.Doc as D
10import qualified Reporting.Doc as D
11import qualified Reporting.Exit.Help as Help
11import qualified Reporting.Exit.Help as Help
12
12
@@ -17,7 +17,7 @@ import qualified Reporting.Exit.Help as Help
17
17
18data Exit
18data Exit
19 = CannotMakeNothing
19 = CannotMakeNothing
20− | CannotOptimizeDebugValues Module.Raw [Module.Raw]
20+ | CannotOptimizeDebugValues ModuleName.Raw [ModuleName.Raw]
21 | CannotOptimizeAndDebug
21 | CannotOptimizeAndDebug
22
22
23
23
@@ -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 . Module.nameToString) (m:ms)
45+ [ D.indent 4 $ D.red $ D.vcat $ map (D.fromString . ModuleName.nameToString) (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/Progress.hs+3−3
@@ -14,7 +14,7 @@ module Reporting.Progress
14
14
15import Control.Concurrent.Chan (Chan, writeChan)
15import Control.Concurrent.Chan (Chan, writeChan)
16import Control.Concurrent.MVar (MVar, newEmptyMVar, readMVar)
16import Control.Concurrent.MVar (MVar, newEmptyMVar, readMVar)
17−import qualified Elm.Compiler.Module as Module
17+import qualified Elm.ModuleName as ModuleName
18import Deps.Diff (Magnitude)
18import Deps.Diff (Magnitude)
19import Elm.Package (Name, Version)
19import Elm.Package (Name, Version)
20import qualified Reporting.Doc as D
20import qualified Reporting.Doc as D
@@ -84,8 +84,8 @@ data Progress
84
84
85 -- compile files
85 -- compile files
86 | CompileStart Int
86 | CompileStart Int
87− | CompileFileStart Module.Raw
87+ | CompileFileStart ModuleName.Raw
88− | CompileFileEnd Module.Raw Outcome
88+ | CompileFileEnd ModuleName.Raw Outcome
89 | CompileEnd
89 | CompileEnd
90
90
91 -- publish
91 -- publish
builder/src/Stuff/Paths.hs+6−6
@@ -17,7 +17,7 @@ import qualified System.Directory as Dir
17import System.FilePath ((</>), (<.>))
17import System.FilePath ((</>), (<.>))
18
18
19import qualified Elm.Compiler as Compiler
19import qualified Elm.Compiler as Compiler
20−import qualified Elm.Compiler.Module as Module
20+import qualified Elm.ModuleName as ModuleName
21import qualified Elm.Package as Pkg
21import qualified Elm.Package as Pkg
22import qualified Reporting.Task as Task
22import qualified Reporting.Task as Task
23
23
@@ -64,24 +64,24 @@ removeStuff root =
64-- ELMI and ELMO
64-- ELMI and ELMO
65
65
66
66
67−elmi :: FilePath -> Module.Raw -> FilePath
67+elmi :: FilePath -> ModuleName.Raw -> FilePath
68elmi root name =
68elmi root name =
69 toArtifactPath root name "elmi"
69 toArtifactPath root name "elmi"
70
70
71
71
72−elmo :: FilePath -> Module.Raw -> FilePath
72+elmo :: FilePath -> ModuleName.Raw -> FilePath
73elmo root name =
73elmo root name =
74 toArtifactPath root name "elmo"
74 toArtifactPath root name "elmo"
75
75
76
76
77−moduleDocs :: FilePath -> Module.Raw -> FilePath
77+moduleDocs :: FilePath -> ModuleName.Raw -> FilePath
78moduleDocs root name =
78moduleDocs root name =
79 toArtifactPath root name "json"
79 toArtifactPath root name "json"
80
80
81
81
82−toArtifactPath :: FilePath -> Module.Raw -> String -> FilePath
82+toArtifactPath :: FilePath -> ModuleName.Raw -> String -> FilePath
83toArtifactPath root name ext =
83toArtifactPath root name ext =
84− root </> stuff </> Module.nameToHyphenPath name <.> ext
84+ root </> stuff </> ModuleName.nameToHyphenPath name <.> ext
85
85
86
86
87
87
builder/src/Stuff/Verify.hs+3−4
@@ -9,10 +9,9 @@ import Control.Monad (liftM2, liftM4)
9import Data.Binary
9import Data.Binary
10import Data.Map (Map)
10import Data.Map (Map)
11
11
12−import qualified Elm.Compiler.Module as Module
13−import Elm.Package (Name, Version)
14−
15import qualified Deps.Verify as Verify
12import qualified Deps.Verify as Verify
13+import qualified Elm.Interface as I
14+import Elm.Package (Name, Version)
16import qualified Elm.Project.Json as Project
15import qualified Elm.Project.Json as Project
17import qualified Elm.Project.Constraint as Con
16import qualified Elm.Project.Constraint as Con
18import qualified Elm.Project.Summary as Summary
17import qualified Elm.Project.Summary as Summary
@@ -56,7 +55,7 @@ data MiniSummary =
56 MiniSummary
55 MiniSummary
57 { _deps :: ProjectDeps
56 { _deps :: ProjectDeps
58 , _exposed :: Summary.ExposedModules
57 , _exposed :: Summary.ExposedModules
59− , _ifaces :: Module.Interfaces
58+ , _ifaces :: I.Interfaces
60 , _depsGraph :: Summary.DepsGraph
59 , _depsGraph :: Summary.DepsGraph
61 }
60 }
62
61