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 -}
|
{- Catches IO errors and returns a Maybe -}
|
||||||
catchMaybeIO :: MonadCatch m => m a -> m (Maybe a)
|
catchMaybeIO :: MonadCatch m => m a -> m (Maybe a)
|
||||||
catchMaybeIO a = do
|
catchMaybeIO a = catchDefaultIO Nothing $ a >>= (return . Just)
|
||||||
catchDefaultIO Nothing $ do
|
|
||||||
v <- a
|
|
||||||
return (Just v)
|
|
||||||
|
|
||||||
{- Catches IO errors and returns a default value. -}
|
{- Catches IO errors and returns a default value. -}
|
||||||
catchDefaultIO :: MonadCatch m => a -> m a -> m a
|
catchDefaultIO :: MonadCatch m => a -> m a -> m a
|
||||||
|
|
|
@ -136,7 +136,7 @@ hGetSomeString h sz = do
|
||||||
- if this reap gets there first. -}
|
- if this reap gets there first. -}
|
||||||
reapZombies :: IO ()
|
reapZombies :: IO ()
|
||||||
#ifndef mingw32_HOST_OS
|
#ifndef mingw32_HOST_OS
|
||||||
reapZombies = do
|
reapZombies =
|
||||||
-- throws an exception when there are no child processes
|
-- throws an exception when there are no child processes
|
||||||
catchDefaultIO Nothing (getAnyProcessStatus False True)
|
catchDefaultIO Nothing (getAnyProcessStatus False True)
|
||||||
>>= maybe (return ()) (const reapZombies)
|
>>= maybe (return ()) (const reapZombies)
|
||||||
|
|
|
@ -172,7 +172,7 @@ createBackgroundProcess p a = a =<< createProcess p
|
||||||
-- returns a transcript combining its stdout and stderr, and
|
-- returns a transcript combining its stdout and stderr, and
|
||||||
-- whether it succeeded or failed.
|
-- whether it succeeded or failed.
|
||||||
processTranscript :: String -> [String] -> (Maybe String) -> IO (String, Bool)
|
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' :: String -> [String] -> Maybe [(String, String)] -> (Maybe String) -> IO (String, Bool)
|
||||||
processTranscript' cmd opts environ input = do
|
processTranscript' cmd opts environ input = do
|
||||||
|
@ -378,11 +378,10 @@ createProcess p = do
|
||||||
|
|
||||||
-- | Debugging trace for a CreateProcess.
|
-- | Debugging trace for a CreateProcess.
|
||||||
debugProcess :: CreateProcess -> IO ()
|
debugProcess :: CreateProcess -> IO ()
|
||||||
debugProcess p = do
|
debugProcess p = debugM "Utility.Process" $ unwords
|
||||||
debugM "Utility.Process" $ unwords
|
[ action ++ ":"
|
||||||
[ action ++ ":"
|
, showCmd p
|
||||||
, showCmd p
|
]
|
||||||
]
|
|
||||||
where
|
where
|
||||||
action
|
action
|
||||||
| piped (std_in p) && piped (std_out p) = "chat"
|
| piped (std_in p) && piped (std_out p) = "chat"
|
||||||
|
|
|
@ -286,7 +286,7 @@ fromScheduledTime AnyTime = "any time"
|
||||||
fromScheduledTime (SpecificTime h m) =
|
fromScheduledTime (SpecificTime h m) =
|
||||||
show h' ++ (if m > 0 then ":" ++ pad 2 (show m) else "") ++ " " ++ ampm
|
show h' ++ (if m > 0 then ":" ++ pad 2 (show m) else "") ++ " " ++ ampm
|
||||||
where
|
where
|
||||||
pad n s = take (n - length s) (repeat '0') ++ s
|
pad n s = replicate (n - length s) '0' ++ s
|
||||||
(h', ampm)
|
(h', ampm)
|
||||||
| h == 0 = (12, "AM")
|
| h == 0 = (12, "AM")
|
||||||
| h < 12 = (h, "AM")
|
| h < 12 = (h, "AM")
|
||||||
|
|
Loading…
Add table
Reference in a new issue