aboutsummaryrefslogtreecommitdiffstats
path: root/app/Parallel.hs
diff options
context:
space:
mode:
Diffstat (limited to 'app/Parallel.hs')
-rw-r--r--app/Parallel.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/app/Parallel.hs b/app/Parallel.hs
index 1687364..e590164 100644
--- a/app/Parallel.hs
+++ b/app/Parallel.hs
@@ -1,6 +1,6 @@
-module Parallel (parMapM, parSequence) where
+module Parallel (parMapM, parMapM_, parSequence) where
-import Control.Concurrent.ParallelIO.Local (parallel, withPool)
+import Control.Concurrent.ParallelIO.Local (parallel, parallel_, withPool)
import GHC.Conc (getNumProcessors)
parMapM :: (a -> IO b) -> [a] -> IO [b]
@@ -8,6 +8,11 @@ parMapM f xs = do
n <- getNumProcessors
withPool n $ \pool -> parallel pool (map f xs)
+parMapM_ :: (a -> IO ()) -> [a] -> IO ()
+parMapM_ f xs = do
+ n <- getNumProcessors
+ withPool n $ \pool -> parallel_ pool (map f xs)
+
parSequence :: [IO a] -> IO [a]
parSequence xs = do
n <- getNumProcessors