module Control.Concurrent.Simaphore ( mapPool ) where import Control.Concurrent.MSem -- | Simaphore-based throttled 'mapConcurrently'. mapPool :: Traversable t => Int -> (a -> IO b) -> t a -> IO (t b) mapPool lim f xs = do sima <- new lim mapConcurrently (with sima . f) xs