1
1
mirror of https://github.com/github/semantic.git synced 2024-12-20 21:31:48 +03:00

Use unwords and fmap instead of foldr and <>

This commit is contained in:
Timothy Clem 2017-07-28 08:12:28 -07:00
parent 2de353451d
commit 709c4c98fc

View File

@ -201,7 +201,7 @@ runTaskWithOptions options task = do
ReadBlobPairs source -> (either Files.readBlobPairsFromHandle (traverse (traverse (uncurry Files.readFile))) source >>= yield) `catchError` (pure . Left. displayException) ReadBlobPairs source -> (either Files.readBlobPairsFromHandle (traverse (traverse (uncurry Files.readFile))) source >>= yield) `catchError` (pure . Left. displayException)
WriteToOutput destination contents -> either B.hPutStr B.writeFile destination contents >>= yield WriteToOutput destination contents -> either B.hPutStr B.writeFile destination contents >>= yield
WriteLog level msg pairs WriteLog level msg pairs
| Just logLevel <- optionsLevel options, level <= logLevel -> let message = printf "%-20s %s" msg (foldr (\ a b -> uncurry (printf "%s=%s") a <> " " <> b) ("" :: String) pairs) in Time.getCurrentTime >>= atomically . writeTMQueue logQueue . Message level message >>= yield | Just logLevel <- optionsLevel options, level <= logLevel -> let message = printf "%-20s %s" msg (unwords (uncurry (printf "%s=%s") <$> pairs)) in Time.getCurrentTime >>= atomically . writeTMQueue logQueue . Message level message >>= yield
| otherwise -> pure () >>= yield | otherwise -> pure () >>= yield
Parse parser blob -> go (runParser options parser blob) >>= either (pure . Left) (either (pure . Left) yield) Parse parser blob -> go (runParser options parser blob) >>= either (pure . Left) (either (pure . Left) yield)
Decorate algebra term -> pure (decoratorWithAlgebra algebra term) >>= yield Decorate algebra term -> pure (decoratorWithAlgebra algebra term) >>= yield