on master help sign in
move getMainNames function to Build.hs
02a39a8Evan Czaplicki
builder/src/Build.hs+18−1
@@ -8,6 +8,7 @@ module Build
8 , Module(..)
8 , Module(..)
9 , CachedInterface(..)
9 , CachedInterface(..)
10 , DocsGoal(..)
10 , DocsGoal(..)
11+ , getMainNames
11 )
12 )
12 where
13 where
13
14
@@ -185,6 +186,22 @@ fromMains style root details paths =
185
186
186
187
187
188
189+-- GET MAIN NAMES
190+
191+
192+getMainNames :: Artifacts -> NE.List ModuleName.Raw
193+getMainNames (Artifacts _ _ mains _) =
194+ fmap getMainName mains
195+
196+
197+getMainName :: Main -> ModuleName.Raw
198+getMainName main =
199+ case main of
200+ Inside name -> name
201+ Outside name _ _ -> name
202+
203+
204+
188-- CRAWL
205-- CRAWL
189
206
190
207
@@ -878,7 +895,7 @@ isInsideSrcDirs (Env _ root _ srcDirs _ _) path absolutePath =
878 case (exits, Maybe.catMaybes maybes) of
895 case (exits, Maybe.catMaybes maybes) of
879 (_, [(_,name)]) -> Right (Location absolutePath path (LInside name))
896 (_, [(_,name)]) -> Right (Location absolutePath path (LInside name))
880 ([], []) -> Right (Location absolutePath path (LOutside path))
897 ([], []) -> Right (Location absolutePath path (LOutside path))
881− (_, (s1,_):(s2,_):_) -> Left (Exit.BP_WithAmbiguousSrcDir s1 s2)
898+ (_, (s1,_):(s2,_):_) -> Left (Exit.BP_WithAmbiguousSrcDir path s1 s2)
882 (exit:_, _) -> Left exit
899 (exit:_, _) -> Left exit
883
900
884
901