From 1a287c55754be9013422387a83f26d9ad51f4299 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Thu, 14 Jul 2022 00:20:07 -0400 Subject: Remove unnecessary Map --- Biz/Bild.hs | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'Biz/Bild.hs') 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 -- cgit v1.2.3