on master help sign in
do some renaming in Build module

Main => Root fromMains => fromPaths getMainNames => getRootNames The point is to distinguish "root file paths" given to `elm make` from modules that happen to have `main` defined.

commitd39f211cd9e82715a202695c3a01fa6e0f57475f authorEvan Czaplicki <evancz@users.noreply.github.com> dateMon 7 Oct 2019, 16:14 (7 years ago) parent171e834
6 files changed+119−119
builder/src/Build.hs+89−89 builder/src/Generate.hs+6−6 builder/src/Reporting/Exit.hs+4−4 terminal/src/Develop.hs+2−2 terminal/src/Develop/StaticFiles/Build.hs+3−3 terminal/src/Make.hs+15−15
builder/src/Build.hs+89−89
@@ -2,15 +2,15 @@
22{-# LANGUAGE BangPatterns, GADTs, OverloadedStrings #-}
33module Build
44 ( fromExposed
5− , fromMains
5+ , fromPaths
66 , fromRepl
77 , Artifacts(..)
8− , Main(..)
8+ , Root(..)
99 , Module(..)
1010 , CachedInterface(..)
1111 , ReplArtifacts(..)
1212 , DocsGoal(..)
13− , getMainNames
13+ , getRootNames
1414 )
1515 where
1616
@@ -164,14 +164,14 @@ fromExposed style root details docsGoal exposed@(NE.List e es) =
164164
165165
166166
167−-- FROM MAINS
167+-- FROM PATHS
168168
169169
170170data Artifacts =
171171 Artifacts
172172 { _name :: Pkg.Name
173173 , _deps :: Dependencies
174− , _mains :: NE.List Main
174+ , _roots :: NE.List Root
175175 , _modules :: [Module]
176176 }
177177
@@ -185,25 +185,25 @@ type Dependencies =
185185 Map.Map ModuleName.Canonical I.DependencyInterface
186186
187187
188−fromMains :: Reporting.Style -> FilePath -> Details.Details -> NE.List FilePath -> IO (Either Exit.BuildProblem Artifacts)
189−fromMains style root details paths =
188+fromPaths :: Reporting.Style -> FilePath -> Details.Details -> NE.List FilePath -> IO (Either Exit.BuildProblem Artifacts)
189+fromPaths style root details paths =
190190 Reporting.trackBuild style $ \key ->
191191 do env <- makeEnv key root details
192192
193− elmains <- findMains env paths
194− case elmains of
193+ elroots <- findRoots env paths
194+ case elroots of
195195 Left problem ->
196196 return (Left (Exit.BuildProjectProblem problem))
197197
198− Right lmains ->
198+ Right lroots ->
199199 do -- crawl
200200 dmvar <- Details.loadInterfaces root details
201201 smvar <- newMVar Map.empty
202− smainMVars <- traverse (fork . crawlMain env smvar) lmains
203− smains <- traverse readMVar smainMVars
202+ srootMVars <- traverse (fork . crawlRoot env smvar) lroots
203+ sroots <- traverse readMVar srootMVars
204204 statuses <- traverse readMVar =<< readMVar smvar
205205
206− midpoint <- checkMainsMidpoint dmvar statuses smains
206+ midpoint <- checkMidpointAndRoots dmvar statuses sroots
207207 case midpoint of
208208 Left problem ->
209209 return (Left (Exit.BuildProjectProblem problem))
@@ -213,24 +213,24 @@ fromMains style root details paths =
213213 rmvar <- newEmptyMVar
214214 resultsMVars <- forkWithKey (checkModule env foreigns rmvar) statuses
215215 putMVar rmvar resultsMVars
216− rmainMVars <- traverse (fork . checkMain env resultsMVars) smains
216+ rrootMVars <- traverse (fork . checkRoot env resultsMVars) sroots
217217 results <- traverse readMVar resultsMVars
218218 writeDetails root details results
219− toArtifacts env foreigns results <$> traverse readMVar rmainMVars
219+ toArtifacts env foreigns results <$> traverse readMVar rrootMVars
220220
221221
222222
223−-- GET MAIN NAMES
223+-- GET ROOT NAMES
224224
225225
226−getMainNames :: Artifacts -> NE.List ModuleName.Raw
227−getMainNames (Artifacts _ _ mains _) =
228− fmap getMainName mains
226+getRootNames :: Artifacts -> NE.List ModuleName.Raw
227+getRootNames (Artifacts _ _ roots _) =
228+ fmap getRootName roots
229229
230230
231−getMainName :: Main -> ModuleName.Raw
232−getMainName main =
233− case main of
231+getRootName :: Root -> ModuleName.Raw
232+getRootName root =
233+ case root of
234234 Inside name -> name
235235 Outside name _ _ -> name
236236
@@ -585,11 +585,11 @@ checkMidpoint dmvar statuses =
585585 return (Left (Exit.BP_Cycle name names))
586586
587587
588−checkMainsMidpoint :: MVar (Maybe Dependencies) -> Map.Map ModuleName.Raw Status -> NE.List MainStatus -> IO (Either Exit.BuildProjectProblem Dependencies)
589−checkMainsMidpoint dmvar statuses smains =
588+checkMidpointAndRoots :: MVar (Maybe Dependencies) -> Map.Map ModuleName.Raw Status -> NE.List RootStatus -> IO (Either Exit.BuildProjectProblem Dependencies)
589+checkMidpointAndRoots dmvar statuses sroots =
590590 case checkForCycles statuses of
591591 Nothing ->
592− case checkUniqueMains statuses smains of
592+ case checkUniqueRoots statuses sroots of
593593 Nothing ->
594594 do maybeForeigns <- readMVar dmvar
595595 case maybeForeigns of
@@ -651,14 +651,14 @@ addToGraph name status graph =
651651
652652
653653
654−-- CHECK UNIQUE MAINS
654+-- CHECK UNIQUE ROOTS
655655
656656
657−checkUniqueMains :: Map.Map ModuleName.Raw Status -> NE.List MainStatus -> Maybe Exit.BuildProjectProblem
658−checkUniqueMains insides smains =
657+checkUniqueRoots :: Map.Map ModuleName.Raw Status -> NE.List RootStatus -> Maybe Exit.BuildProjectProblem
658+checkUniqueRoots insides sroots =
659659 let
660660 outsidesDict =
661− Map.fromListWith OneOrMore.more (Maybe.mapMaybe mainStatusToNamePathPair (NE.toList smains))
661+ Map.fromListWith OneOrMore.more (Maybe.mapMaybe rootStatusToNamePathPair (NE.toList sroots))
662662 in
663663 case Map.traverseWithKey checkOutside outsidesDict of
664664 Left problem ->
@@ -670,9 +670,9 @@ checkUniqueMains insides smains =
670670 Left problem -> Just problem
671671
672672
673−mainStatusToNamePathPair :: MainStatus -> Maybe (ModuleName.Raw, OneOrMore.OneOrMore FilePath)
674−mainStatusToNamePathPair smain =
675− case smain of
673+rootStatusToNamePathPair :: RootStatus -> Maybe (ModuleName.Raw, OneOrMore.OneOrMore FilePath)
674+rootStatusToNamePathPair sroot =
675+ case sroot of
676676 SInside _ -> Nothing
677677 SOutsideOk (Details.Local path _ _ _ _ _) _ modul -> Just (Src.getName modul, OneOrMore.one path)
678678 SOutsideErr _ -> Nothing
@@ -682,14 +682,14 @@ checkOutside :: ModuleName.Raw -> OneOrMore.OneOrMore FilePath -> Either Exit.Bu
682682checkOutside name paths =
683683 case OneOrMore.destruct NE.List paths of
684684 NE.List p [] -> Right p
685− NE.List p1 (p2:_) -> Left (Exit.BP_MainNameDuplicate name p1 p2)
685+ NE.List p1 (p2:_) -> Left (Exit.BP_RootNameDuplicate name p1 p2)
686686
687687
688688checkInside :: ModuleName.Raw -> FilePath -> Status -> Either Exit.BuildProjectProblem ()
689689checkInside name p1 status =
690690 case status of
691− SCached (Details.Local p2 _ _ _ _ _) -> Left (Exit.BP_MainNameDuplicate name p1 p2)
692− SChanged (Details.Local p2 _ _ _ _ _) _ _ _ -> Left (Exit.BP_MainNameDuplicate name p1 p2)
691+ SCached (Details.Local p2 _ _ _ _ _) -> Left (Exit.BP_RootNameDuplicate name p1 p2)
692+ SChanged (Details.Local p2 _ _ _ _ _) _ _ _ -> Left (Exit.BP_RootNameDuplicate name p1 p2)
693693 SBadImport _ -> Right ()
694694 SBadSyntax _ _ _ _ -> Right ()
695695 SForeign _ -> Right ()
@@ -964,25 +964,25 @@ finalizeReplArtifacts env@(Env _ root projectType _ _ _ _) source modul@(Src.Mod
964964
965965
966966
967−-- FIND MAIN
967+-- FIND ROOT
968968
969969
970−data MainLocation
970+data RootLocation
971971 = LInside ModuleName.Raw
972972 | LOutside FilePath
973973
974974
975−findMains :: Env -> NE.List FilePath -> IO (Either Exit.BuildProjectProblem (NE.List MainLocation))
976−findMains env paths =
977− do mvars <- traverse (fork . findLocation env) paths
978− elocs <- traverse readMVar mvars
979− return $ checkLocations =<< sequence elocs
975+findRoots :: Env -> NE.List FilePath -> IO (Either Exit.BuildProjectProblem (NE.List RootLocation))
976+findRoots env paths =
977+ do mvars <- traverse (fork . getRootInfo env) paths
978+ einfos <- traverse readMVar mvars
979+ return $ checkRoots =<< sequence einfos
980980
981981
982−checkLocations :: NE.List Location -> Either Exit.BuildProjectProblem (NE.List MainLocation)
983−checkLocations locations =
982+checkRoots :: NE.List RootInfo -> Either Exit.BuildProjectProblem (NE.List RootLocation)
983+checkRoots infos =
984984 let
985− toOneOrMore loc@(Location absolute _ _) =
985+ toOneOrMore loc@(RootInfo absolute _ _) =
986986 (absolute, OneOrMore.one loc)
987987
988988 fromOneOrMore loc locs =
@@ -990,33 +990,33 @@ checkLocations locations =
990990 [] -> Right ()
991991 loc2:_ -> Left (Exit.BP_MainPathDuplicate (_relative loc) (_relative loc2))
992992 in
993− fmap (\_ -> fmap _location locations) $
993+ fmap (\_ -> fmap _location infos) $
994994 traverse (OneOrMore.destruct fromOneOrMore) $
995− Map.fromListWith OneOrMore.more $ map toOneOrMore (NE.toList locations)
995+ Map.fromListWith OneOrMore.more $ map toOneOrMore (NE.toList infos)
996996
997997
998998
999−-- LOCATIONS
999+-- ROOT INFO
10001000
10011001
1002−data Location =
1003− Location
1002+data RootInfo =
1003+ RootInfo
10041004 { _absolute :: FilePath
10051005 , _relative :: FilePath
1006− , _location :: MainLocation
1006+ , _location :: RootLocation
10071007 }
10081008
10091009
1010−findLocation :: Env -> FilePath -> IO (Either Exit.BuildProjectProblem Location)
1011−findLocation env path =
1010+getRootInfo :: Env -> FilePath -> IO (Either Exit.BuildProjectProblem RootInfo)
1011+getRootInfo env path =
10121012 do exists <- File.exists path
10131013 if exists
1014− then findLoc env path =<< Dir.canonicalizePath path
1014+ then getRootInfoHelp env path =<< Dir.canonicalizePath path
10151015 else return (Left (Exit.BP_PathUnknown path))
10161016
10171017
1018−findLoc :: Env -> FilePath -> FilePath -> IO (Either Exit.BuildProjectProblem Location)
1019−findLoc (Env _ root _ srcDirs _ _ _) path absolutePath =
1018+getRootInfoHelp :: Env -> FilePath -> FilePath -> IO (Either Exit.BuildProjectProblem RootInfo)
1019+getRootInfoHelp (Env _ _ _ srcDirs _ _ _) path absolutePath =
10201020 let
10211021 (dirs, file) = FP.splitFileName absolutePath
10221022 (final, ext) = FP.splitExtension file
@@ -1030,7 +1030,7 @@ findLoc (Env _ root _ srcDirs _ _ _) path absolutePath =
10301030 in
10311031 case Maybe.mapMaybe (isInsideSrcDirByPath absoluteSegments) srcDirs of
10321032 [] ->
1033− return $ Right $ Location absolutePath path (LOutside path)
1033+ return $ Right $ RootInfo absolutePath path (LOutside path)
10341034
10351035 [(_, Right names)] ->
10361036 do let name = Name.fromChars (List.intercalate "." names)
@@ -1039,13 +1039,13 @@ findLoc (Env _ root _ srcDirs _ _ _) path absolutePath =
10391039 d1:d2:_ ->
10401040 do let p1 = addRelative d1 (FP.joinPath names <.> "elm")
10411041 let p2 = addRelative d2 (FP.joinPath names <.> "elm")
1042− return $ Left $ Exit.BP_MainNameDuplicate name p1 p2
1042+ return $ Left $ Exit.BP_RootNameDuplicate name p1 p2
10431043
10441044 _ ->
1045− return $ Right $ Location absolutePath path (LInside name)
1045+ return $ Right $ RootInfo absolutePath path (LInside name)
10461046
10471047 [(s, Left names)] ->
1048− return $ Left $ Exit.BP_MainNameInvalid path s names
1048+ return $ Left $ Exit.BP_RootNameInvalid path s names
10491049
10501050 (s1,_):(s2,_):_ ->
10511051 return $ Left $ Exit.BP_WithAmbiguousSrcDir path s1 s2
@@ -1094,18 +1094,18 @@ dropPrefix roots paths =
10941094
10951095
10961096
1097−-- CRAWL MAINS
1097+-- CRAWL ROOTS
10981098
10991099
1100−data MainStatus
1100+data RootStatus
11011101 = SInside ModuleName.Raw
11021102 | SOutsideOk Details.Local B.ByteString Src.Module
11031103 | SOutsideErr Error.Module
11041104
11051105
1106−crawlMain :: Env -> MVar StatusDict -> MainLocation -> IO MainStatus
1107−crawlMain env@(Env _ _ projectType _ buildID _ _) mvar given =
1108− case given of
1106+crawlRoot :: Env -> MVar StatusDict -> RootLocation -> IO RootStatus
1107+crawlRoot env@(Env _ _ projectType _ buildID _ _) mvar root =
1108+ case root of
11091109 LInside name ->
11101110 do statusMVar <- newEmptyMVar
11111111 statusDict <- takeMVar mvar
@@ -1128,19 +1128,19 @@ crawlMain env@(Env _ _ projectType _ buildID _ _) mvar given =
11281128
11291129
11301130
1131−-- CHECK MAINS
1131+-- CHECK ROOTS
11321132
11331133
1134−data MainResult
1134+data RootResult
11351135 = RInside ModuleName.Raw
11361136 | ROutsideOk ModuleName.Raw I.Interface Opt.LocalGraph
11371137 | ROutsideErr Error.Module
11381138 | ROutsideBlocked
11391139
11401140
1141−checkMain :: Env -> ResultDict -> MainStatus -> IO MainResult
1142−checkMain env@(Env _ root _ _ _ _ _) results pendingMain =
1143− case pendingMain of
1141+checkRoot :: Env -> ResultDict -> RootStatus -> IO RootResult
1142+checkRoot env@(Env _ root _ _ _ _ _) results rootStatus =
1143+ case rootStatus of
11441144 SInside name ->
11451145 return (RInside name)
11461146
@@ -1167,7 +1167,7 @@ checkMain env@(Env _ root _ _ _ _ _) results pendingMain =
11671167 Error.BadImports (toImportErrors env results imports problems)
11681168
11691169
1170−compileOutside :: Env -> Details.Local -> B.ByteString -> Map.Map ModuleName.Raw I.Interface -> Src.Module -> IO MainResult
1170+compileOutside :: Env -> Details.Local -> B.ByteString -> Map.Map ModuleName.Raw I.Interface -> Src.Module -> IO RootResult
11711171compileOutside (Env key _ projectType _ _ _ _) (Details.Local path time _ _ _ _) source ifaces modul =
11721172 let
11731173 pkg = projectTypeToPkg projectType
@@ -1186,35 +1186,35 @@ compileOutside (Env key _ projectType _ _ _ _) (Details.Local path time _ _ _ _)
11861186-- TO ARTIFACTS
11871187
11881188
1189−data Main
1189+data Root
11901190 = Inside ModuleName.Raw
11911191 | Outside ModuleName.Raw I.Interface Opt.LocalGraph
11921192
11931193
1194−toArtifacts :: Env -> Dependencies -> Map.Map ModuleName.Raw Result -> NE.List MainResult -> Either Exit.BuildProblem Artifacts
1195−toArtifacts (Env _ root projectType _ _ _ _) foreigns results mainResults =
1196− case gatherProblemsOrMains results mainResults of
1194+toArtifacts :: Env -> Dependencies -> Map.Map ModuleName.Raw Result -> NE.List RootResult -> Either Exit.BuildProblem Artifacts
1195+toArtifacts (Env _ root projectType _ _ _ _) foreigns results rootResults =
1196+ case gatherProblemsOrMains results rootResults of
11971197 Left (NE.List e es) ->
11981198 Left (Exit.BuildBadModules root e es)
11991199
1200− Right mains ->
1201− Right $ Artifacts (projectTypeToPkg projectType) foreigns mains $
1202− Map.foldrWithKey addInside (foldr addOutside [] mainResults) results
1200+ Right roots ->
1201+ Right $ Artifacts (projectTypeToPkg projectType) foreigns roots $
1202+ Map.foldrWithKey addInside (foldr addOutside [] rootResults) results
12031203
12041204
1205−gatherProblemsOrMains :: Map.Map ModuleName.Raw Result -> NE.List MainResult -> Either (NE.List Error.Module) (NE.List Main)
1206−gatherProblemsOrMains results (NE.List mainResult mainResults) =
1205+gatherProblemsOrMains :: Map.Map ModuleName.Raw Result -> NE.List RootResult -> Either (NE.List Error.Module) (NE.List Root)
1206+gatherProblemsOrMains results (NE.List rootResult rootResults) =
12071207 let
1208− sortMain result (es, mains) =
1208+ addResult result (es, roots) =
12091209 case result of
1210− RInside n -> ( es, Inside n : mains)
1211− ROutsideOk n i o -> ( es, Outside n i o : mains)
1212− ROutsideErr e -> (e:es, mains)
1213− ROutsideBlocked -> ( es, mains)
1210+ RInside n -> ( es, Inside n : roots)
1211+ ROutsideOk n i o -> ( es, Outside n i o : roots)
1212+ ROutsideErr e -> (e:es, roots)
1213+ ROutsideBlocked -> ( es, roots)
12141214
12151215 errors = Map.foldr addErrors [] results
12161216 in
1217− case (mainResult, foldr sortMain (errors, []) mainResults) of
1217+ case (rootResult, foldr addResult (errors, []) rootResults) of
12181218 (RInside n , ( [], ms)) -> Right (NE.List (Inside n) ms)
12191219 (RInside _ , (e:es, _ )) -> Left (NE.List e es)
12201220 (ROutsideOk n i o, ( [], ms)) -> Right (NE.List (Outside n i o) ms)
@@ -1242,9 +1242,9 @@ badInside name =
12421242 "Error from `" ++ Name.toChars name ++ "` should have been reported already."
12431243
12441244
1245−addOutside :: MainResult -> [Module] -> [Module]
1246−addOutside main modules =
1247− case main of
1245+addOutside :: RootResult -> [Module] -> [Module]
1246+addOutside root modules =
1247+ case root of
12481248 RInside _ -> modules
12491249 ROutsideOk name iface objs -> Fresh name iface objs : modules
12501250 ROutsideErr _ -> modules
builder/src/Generate.hs+6−6
@@ -99,18 +99,18 @@ checkForDebugUses (Objects _ locals) =
9999-- GATHER MAINS
100100
101101
102−gatherMains :: Pkg.Name -> Objects -> NE.List Build.Main -> Map.Map ModuleName.Canonical Opt.Main
103−gatherMains pkg (Objects _ locals) buildMains =
104− Map.fromList $ Maybe.mapMaybe (lookupMain pkg locals) (NE.toList buildMains)
102+gatherMains :: Pkg.Name -> Objects -> NE.List Build.Root -> Map.Map ModuleName.Canonical Opt.Main
103+gatherMains pkg (Objects _ locals) roots =
104+ Map.fromList $ Maybe.mapMaybe (lookupMain pkg locals) (NE.toList roots)
105105
106106
107−lookupMain :: Pkg.Name -> Map.Map ModuleName.Raw Opt.LocalGraph -> Build.Main -> Maybe (ModuleName.Canonical, Opt.Main)
108−lookupMain pkg locals buildMain =
107+lookupMain :: Pkg.Name -> Map.Map ModuleName.Raw Opt.LocalGraph -> Build.Root -> Maybe (ModuleName.Canonical, Opt.Main)
108+lookupMain pkg locals root =
109109 let
110110 toPair name (Opt.LocalGraph maybeMain _ _) =
111111 (,) (ModuleName.Canonical pkg name) <$> maybeMain
112112 in
113− case buildMain of
113+ case root of
114114 Build.Inside name -> toPair name =<< Map.lookup name locals
115115 Build.Outside name _ g -> toPair name g
116116
builder/src/Reporting/Exit.hs+4−4
@@ -1767,8 +1767,8 @@ data BuildProjectProblem
17671767 | BP_WithBadExtension FilePath
17681768 | BP_WithAmbiguousSrcDir FilePath FilePath FilePath
17691769 | BP_MainPathDuplicate FilePath FilePath
1770− | BP_MainNameDuplicate ModuleName.Raw FilePath FilePath
1771− | BP_MainNameInvalid FilePath FilePath [String]
1770+ | BP_RootNameDuplicate ModuleName.Raw FilePath FilePath
1771+ | BP_RootNameInvalid FilePath FilePath [String]
17721772 | BP_CannotLoadDependencies
17731773 | BP_Cycle ModuleName.Raw [ModuleName.Raw]
17741774 | BP_MissingExposed (NE.List (ModuleName.Raw, Import.Problem))
@@ -1835,7 +1835,7 @@ toProjectProblemReport projectProblem =
18351835 \ unstuck!"
18361836 ]
18371837
1838− BP_MainNameDuplicate name outsidePath otherPath ->
1838+ BP_RootNameDuplicate name outsidePath otherPath ->
18391839 Help.report "MODULE NAME CLASH" Nothing
18401840 "These two files are causing a module name clash:"
18411841 [ D.indent 4 $ D.red $ D.vcat $ map D.fromChars [ outsidePath, otherPath ]
@@ -1846,7 +1846,7 @@ toProjectProblemReport projectProblem =
18461846 "Try changing to a different module name in one of them!"
18471847 ]
18481848
1849− BP_MainNameInvalid givenPath srcDir _ ->
1849+ BP_RootNameInvalid givenPath srcDir _ ->
18501850 Help.report "UNEXPECTED FILE NAME" Nothing
18511851 "I am having trouble with this file name:"
18521852 [ D.indent 4 $ D.red $ D.fromChars givenPath
terminal/src/Develop.hs+2−2
@@ -159,9 +159,9 @@ compile path =
159159 Just root ->
160160 BW.withScope $ \scope -> Stuff.withRootLock root $ Task.run $
161161 do details <- Task.eio Exit.ReactorBadDetails $ Details.load Reporting.silent scope root
162− artifacts <- Task.eio Exit.ReactorBadBuild $ Build.fromMains Reporting.silent root details (NE.List path [])
162+ artifacts <- Task.eio Exit.ReactorBadBuild $ Build.fromPaths Reporting.silent root details (NE.List path [])
163163 javascript <- Task.mapError Exit.ReactorBadGenerate $ Generate.dev root details artifacts
164− let (NE.List name _) = Build.getMainNames artifacts
164+ let (NE.List name _) = Build.getRootNames artifacts
165165 return $ Html.sandwich name javascript
166166
167167
terminal/src/Develop/StaticFiles/Build.hs+3−3
@@ -42,13 +42,13 @@ buildReactorFrontEnd =
4242 do root <- Dir.getCurrentDirectory
4343 runTaskUnsafe $
4444 do details <- Task.eio Exit.ReactorBadDetails $ Details.load Reporting.silent scope root
45− artifacts <- Task.eio Exit.ReactorBadBuild $ Build.fromMains Reporting.silent root details mains
45+ artifacts <- Task.eio Exit.ReactorBadBuild $ Build.fromPaths Reporting.silent root details paths
4646 javascript <- Task.mapError Exit.ReactorBadGenerate $ Generate.prod root details artifacts
4747 return (LBS.toStrict (B.toLazyByteString javascript))
4848
4949
50−mains :: NE.List FilePath
51−mains =
50+paths :: NE.List FilePath
51+paths =
5252 NE.List
5353 ("src" </> "NotFound.elm")
5454 [ "src" </> "Errors.elm"
terminal/src/Make.hs+15−15
@@ -107,7 +107,7 @@ runHelp root paths style (Flags debug optimize maybeOutput _ maybeDocs) =
107107 case getNoMains artifacts of
108108 [] ->
109109 do builder <- toBuilder root details desiredMode artifacts
110− generate style target builder (Build.getMainNames artifacts)
110+ generate style target builder (Build.getRootNames artifacts)
111111
112112 name:names ->
113113 Task.throw (Exit.MakeNonMainFilesIntoJavaScript name names)
@@ -166,7 +166,7 @@ buildExposed style root details maybeDocs exposed =
166166buildPaths :: Reporting.Style -> FilePath -> Details.Details -> NE.List FilePath -> Task Build.Artifacts
167167buildPaths style root details paths =
168168 Task.eio Exit.MakeCannotBuild $
169− Build.fromMains style root details paths
169+ Build.fromPaths style root details paths
170170
171171
172172
@@ -174,13 +174,13 @@ buildPaths style root details paths =
174174
175175
176176getMains :: Build.Artifacts -> [ModuleName.Raw]
177−getMains (Build.Artifacts _ _ mains modules) =
178− Maybe.mapMaybe (getMain modules) (NE.toList mains)
177+getMains (Build.Artifacts _ _ roots modules) =
178+ Maybe.mapMaybe (getMain modules) (NE.toList roots)
179179
180180
181−getMain :: [Build.Module] -> Build.Main -> Maybe ModuleName.Raw
182−getMain modules main =
183− case main of
181+getMain :: [Build.Module] -> Build.Root -> Maybe ModuleName.Raw
182+getMain modules root =
183+ case root of
184184 Build.Inside name ->
185185 if any (isMain name) modules
186186 then Just name
@@ -207,9 +207,9 @@ isMain targetName modul =
207207
208208
209209hasOneMain :: Build.Artifacts -> Task ModuleName.Raw
210−hasOneMain (Build.Artifacts _ _ mains modules) =
211− case mains of
212− NE.List main [] -> Task.mio Exit.MakeNoMain (return $ getMain modules main)
210+hasOneMain (Build.Artifacts _ _ roots modules) =
211+ case roots of
212+ NE.List root [] -> Task.mio Exit.MakeNoMain (return $ getMain modules root)
213213 NE.List _ (_:_) -> Task.throw Exit.MakeMultipleFilesIntoHtml
214214
215215
@@ -218,13 +218,13 @@ hasOneMain (Build.Artifacts _ _ mains modules) =
218218
219219
220220getNoMains :: Build.Artifacts -> [ModuleName.Raw]
221−getNoMains (Build.Artifacts _ _ mains modules) =
222− Maybe.mapMaybe (getNoMain modules) (NE.toList mains)
221+getNoMains (Build.Artifacts _ _ roots modules) =
222+ Maybe.mapMaybe (getNoMain modules) (NE.toList roots)
223223
224224
225−getNoMain :: [Build.Module] -> Build.Main -> Maybe ModuleName.Raw
226−getNoMain modules main =
227− case main of
225+getNoMain :: [Build.Module] -> Build.Root -> Maybe ModuleName.Raw
226+getNoMain modules root =
227+ case root of
228228 Build.Inside name ->
229229 if any (isMain name) modules
230230 then Nothing