From fc0afaaa273f5b5d3696df87d70d5347a13bb9ac Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Mon, 18 Dec 2023 13:50:22 +0100 Subject: feat: compute history top to bottom Disables caching. --- app/Parallel.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'app/Parallel.hs') 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 -- cgit v1.2.3