merge hlint changes from propellor
This commit is contained in:
parent
6ce5fea50c
commit
2d2e94798f
4 changed files with 8 additions and 12 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Add table
Reference in a new issue