From 773dd51aec39ef4ef8d5818ffe279b0737d4d567 Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Thu, 30 Nov 2023 13:28:30 +0100 Subject: feat: add -p|--patch to log command --- app/Parallel.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'app/Parallel.hs') 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 -- cgit v1.2.3