golfing
This commit is contained in:
parent
38df4ed44f
commit
a71e7161fc
1 changed files with 4 additions and 4 deletions
|
@ -12,9 +12,9 @@ import Common
|
||||||
{- Runs an action in parallel with a set of values.
|
{- Runs an action in parallel with a set of values.
|
||||||
- Returns values that caused the action to fail. -}
|
- Returns values that caused the action to fail. -}
|
||||||
inParallel :: (v -> IO ()) -> [v] -> IO [v]
|
inParallel :: (v -> IO ()) -> [v] -> IO [v]
|
||||||
inParallel a v = do
|
inParallel a l = do
|
||||||
pids <- mapM (forkProcess . a) v
|
pids <- mapM (forkProcess . a) l
|
||||||
statuses <- mapM (getProcessStatus True False) pids
|
statuses <- mapM (getProcessStatus True False) pids
|
||||||
return $ map fst $ filter failed $ zip v statuses
|
return $ map fst $ filter (failed . snd) $ zip l statuses
|
||||||
where
|
where
|
||||||
failed (_, status) = status /= Just (Exited ExitSuccess)
|
failed v = v /= Just (Exited ExitSuccess)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue