From b289dee25ad8ce4c2622fadb2f4c31fb90914b39 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Fri, 29 Jan 2021 02:37:14 -0500 Subject: Lint 'return' into 'pure', replace bind operator --- Biz/Lint.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Biz/Lint.hs') diff --git a/Biz/Lint.hs b/Biz/Lint.hs index 66c7900..bd71835 100644 --- a/Biz/Lint.hs +++ b/Biz/Lint.hs @@ -28,13 +28,13 @@ main = Cli.main <| Cli.Plan help move test move :: Cli.Arguments -> IO () move args = case Cli.getAllArgs args (Cli.argument "file") of - [] -> changedFiles >>= run >>= exit + [] -> changedFiles +> run +> exit files -> files |> filter notcab |> filterM Directory.doesFileExist - >>= run - >>= exit + +> run + +> exit test :: Test.Tree test = @@ -83,7 +83,7 @@ printResult r@(NoOp path_) = >> pure r changedFiles :: IO [FilePath] -changedFiles = mergeBase >>= changed +changedFiles = mergeBase +> changed where git args = Process.readProcess "git" args "" mergeBase = git ["merge-base", "HEAD", "origin/master"] /> filter (/= '\n') @@ -109,7 +109,7 @@ run paths = do concat FilePath -> FilePath -> IO [Result] -runOne root cwd path_ = results >>= mapM_ printResult >> results +runOne root cwd path_ = results +> mapM_ printResult >> results where results = sequence <| case Namespace.fromPath root (cwd path_) of @@ -128,7 +128,7 @@ runOne root cwd path_ = results >>= mapM_ printResult >> results lint :: Linter -> [String] -> FilePath -> IO Result lint bin args path_ = - Process.readProcessWithExitCode (Text.unpack bin) (args ++ [path_]) "" >>= \case + Process.readProcessWithExitCode (Text.unpack bin) (args ++ [path_]) "" +> \case (Exit.ExitSuccess, _, _) -> pure <| Ok path_ bin Good (Exit.ExitFailure _, msg, _) -> pure <| Ok path_ bin <| Bad msg -- cgit v1.2.3