diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-09-13 13:39:48 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-09-13 13:39:48 -0400 |
commit | 6b209cd8578a4509e67dc187271f5f3a193acd97 (patch) | |
tree | 353b62e3fbe1e212e0af377722c3c3980a188826 /Utility | |
parent | 1e9b95d13b4bd3461add92096fc142ef5126eab9 (diff) |
merge hlint changes from propellor
Diffstat (limited to 'Utility')
-rw-r--r-- | Utility/Exception.hs | 5 | ||||
-rw-r--r-- | Utility/Misc.hs | 2 | ||||
-rw-r--r-- | Utility/Process.hs | 11 | ||||
-rw-r--r-- | Utility/Scheduled.hs | 2 |
4 files changed, 8 insertions, 12 deletions
diff --git a/Utility/Exception.hs b/Utility/Exception.hs index 30bcc9245..13000e033 100644 --- a/Utility/Exception.hs +++ b/Utility/Exception.hs @@ -39,10 +39,7 @@ catchBoolIO = catchDefaultIO False {- Catches IO errors and returns a Maybe -} catchMaybeIO :: MonadCatch m => m a -> m (Maybe a) -catchMaybeIO a = do - catchDefaultIO Nothing $ do - v <- a - return (Just v) +catchMaybeIO a = catchDefaultIO Nothing $ a >>= (return . Just) {- Catches IO errors and returns a default value. -} catchDefaultIO :: MonadCatch m => a -> m a -> m a diff --git a/Utility/Misc.hs b/Utility/Misc.hs index 45d5a0639..ebb42576b 100644 --- a/Utility/Misc.hs +++ b/Utility/Misc.hs @@ -136,7 +136,7 @@ hGetSomeString h sz = do - if this reap gets there first. -} reapZombies :: IO () #ifndef mingw32_HOST_OS -reapZombies = do +reapZombies = -- throws an exception when there are no child processes catchDefaultIO Nothing (getAnyProcessStatus False True) >>= maybe (return ()) (const reapZombies) diff --git a/Utility/Process.hs b/Utility/Process.hs index 205994811..c4882a014 100644 --- a/Utility/Process.hs +++ b/Utility/Process.hs @@ -172,7 +172,7 @@ createBackgroundProcess p a = a =<< createProcess p -- returns a transcript combining its stdout and stderr, and -- whether it succeeded or failed. processTranscript :: String -> [String] -> (Maybe String) -> IO (String, Bool) -processTranscript cmd opts input = processTranscript' cmd opts Nothing input +processTranscript cmd opts = processTranscript' cmd opts Nothing processTranscript' :: String -> [String] -> Maybe [(String, String)] -> (Maybe String) -> IO (String, Bool) processTranscript' cmd opts environ input = do @@ -378,11 +378,10 @@ createProcess p = do -- | Debugging trace for a CreateProcess. debugProcess :: CreateProcess -> IO () -debugProcess p = do - debugM "Utility.Process" $ unwords - [ action ++ ":" - , showCmd p - ] +debugProcess p = debugM "Utility.Process" $ unwords + [ action ++ ":" + , showCmd p + ] where action | piped (std_in p) && piped (std_out p) = "chat" diff --git a/Utility/Scheduled.hs b/Utility/Scheduled.hs index b3813323d..5e813d4a2 100644 --- a/Utility/Scheduled.hs +++ b/Utility/Scheduled.hs @@ -286,7 +286,7 @@ fromScheduledTime AnyTime = "any time" fromScheduledTime (SpecificTime h m) = show h' ++ (if m > 0 then ":" ++ pad 2 (show m) else "") ++ " " ++ ampm where - pad n s = take (n - length s) (repeat '0') ++ s + pad n s = replicate (n - length s) '0' ++ s (h', ampm) | h == 0 = (12, "AM") | h < 12 = (h, "AM") |