summaryrefslogtreecommitdiff
path: root/Biz/Lint.hs
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2021-01-29 02:37:14 -0500
committerBen Sima <ben@bsima.me>2021-01-29 03:22:01 -0500
commitb289dee25ad8ce4c2622fadb2f4c31fb90914b39 (patch)
tree5511da780cdabbb98c8fbe01f03997d3263e7880 /Biz/Lint.hs
parent42c7614b6a4bd7504e9bf31e0882db58b85857bc (diff)
Lint 'return' into 'pure', replace bind operator
Diffstat (limited to 'Biz/Lint.hs')
-rw-r--r--Biz/Lint.hs12
1 files changed, 6 insertions, 6 deletions
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 </ mapM (runOne root cwd) paths
runOne :: FilePath -> 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