diff options
author | Alexander Foremny <aforemny@posteo.de> | 2023-11-30 13:28:30 +0100 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2023-11-30 14:40:17 +0100 |
commit | 773dd51aec39ef4ef8d5818ffe279b0737d4d567 (patch) | |
tree | f26033b2c0294857d25cf6dc5aa0a5b7791663c3 /app/Parallel.hs | |
parent | 4718d91d1a641b255fec2dd8a9b36fd3d4e60ea6 (diff) |
feat: add -p|--patch to log command
Diffstat (limited to 'app/Parallel.hs')
-rw-r--r-- | app/Parallel.hs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/Parallel.hs b/app/Parallel.hs index 0b57545..1687364 100644 --- a/app/Parallel.hs +++ b/app/Parallel.hs @@ -1,4 +1,4 @@ -module Parallel (parMapM) where +module Parallel (parMapM, parSequence) where import Control.Concurrent.ParallelIO.Local (parallel, withPool) import GHC.Conc (getNumProcessors) @@ -7,3 +7,8 @@ parMapM :: (a -> IO b) -> [a] -> IO [b] parMapM f xs = do n <- getNumProcessors withPool n $ \pool -> parallel pool (map f xs) + +parSequence :: [IO a] -> IO [a] +parSequence xs = do + n <- getNumProcessors + withPool n $ \pool -> parallel pool xs |