diff options
author | Alexander Foremny <aforemny@posteo.de> | 2023-12-18 13:50:22 +0100 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2024-03-25 07:42:51 +0100 |
commit | fc0afaaa273f5b5d3696df87d70d5347a13bb9ac (patch) | |
tree | a7e48842f71511f39a367e5dff84f41c02f3d859 /app/Parallel.hs | |
parent | 812fcbadae72960d200286355c9aaecfbe350bf2 (diff) |
feat: compute history top to bottom
Disables caching.
Diffstat (limited to 'app/Parallel.hs')
-rw-r--r-- | app/Parallel.hs | 9 |
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 |