summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2022-07-14 00:20:07 -0400
committerBen Sima <ben@bsima.me>2022-07-14 00:34:04 -0400
commit1a287c55754be9013422387a83f26d9ad51f4299 (patch)
tree2affc1811e6d9cd85ba687b85129c0eee366e804
parent815ba6658750a97d98ff969eb0dc898bbd2f3aa4 (diff)
Remove unnecessary Map
-rw-r--r--Biz/Bild.hs24
1 files changed, 8 insertions, 16 deletions
diff --git a/Biz/Bild.hs b/Biz/Bild.hs
index 4d55e0b..eee3c49 100644
--- a/Biz/Bild.hs
+++ b/Biz/Bild.hs
@@ -115,7 +115,6 @@ import qualified Data.Conduit as Conduit
import qualified Data.Conduit.List as Conduit
import qualified Data.Conduit.Process as Conduit
import qualified Data.List as List
-import qualified Data.Map as Map
import qualified Data.Maybe as Maybe
import qualified Data.Set as Set
import qualified Data.String as String
@@ -152,28 +151,21 @@ move args =
>> pure (Cli.getAllArgs args (Cli.argument "target"))
/> filter (not <. Namespace.isCab)
+> filterM Dir.doesFileExist
- +> traverse (\fn -> analyze fn /> (fn,))
- /> filter (snd .> isJust)
- /> Map.fromList
- /> Map.map Maybe.fromJust
- /> Map.filter (namespace .> isBuildableNs)
+ +> traverse analyze
+ /> filter isJust
+ /> map Maybe.fromJust
+ /> filter (namespace .> isBuildableNs)
+> printOrBuild
+> exitSummary
where
- printOrBuild :: Map FilePath Target -> IO [ExitCode]
- printOrBuild analyses
+ printOrBuild :: [Target] -> IO [ExitCode]
+ printOrBuild targets
| args `Cli.has` Cli.longOption "json" =
- analyses
- |> Map.elems
- |> putJSON
- >> pure [Exit.ExitSuccess]
+ traverse_ putJSON targets >> pure [Exit.ExitSuccess]
| otherwise = do
root <- Env.getEnv "BIZ_ROOT"
createHier root
- analyses
- |> Map.toList
- |> map snd
- |> traverse (build isTest isLoud)
+ traverse (build isTest isLoud) targets
isTest = args `Cli.has` Cli.longOption "test"
isLoud = args `Cli.has` Cli.longOption "loud"
putJSON = Aeson.encode .> ByteString.toStrict .> Char8.putStrLn