aboutsummaryrefslogtreecommitdiffstats
path: root/app/Parallel.hs
diff options
context:
space:
mode:
Diffstat (limited to 'app/Parallel.hs')
-rw-r--r--app/Parallel.hs7
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