aboutsummaryrefslogtreecommitdiffstats
path: root/app/Parallel.hs
blob: 0b575456cd67236759dd80d11a8191b4ed891398 (plain)
1
2
3
4
5
6
7
8
9
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)