module Parallel (parMapM) where import Control.Concurrent.ParallelIO.Local (parallel, withPool) import GHC.Conc (getNumProcessors) parMapM :: (a -> IO b) -> [a] -> IO [b] parMapM f xs = do n <- getNumProcessors withPool n $ \pool -> parallel pool (map f xs)