pooled-io-0.0.2.3: Run jobs on a limited number of threads and support data dependencies
Safe HaskellSafe
LanguageHaskell98

Control.Concurrent.PooledIO.Final

Description

This module implements something similar to Control.Concurrent.PooledIO.InOrder, but since it is restricted to an Applicative interface we can implement it without unsafeInterleaveIO.

Synopsis

Documentation

data T a Source #

Instances

Instances details
Applicative T Source # 
Instance details

Defined in Control.Concurrent.PooledIO.Final

Methods

pure :: a -> T a #

(<*>) :: T (a -> b) -> T a -> T b #

liftA2 :: (a -> b -> c) -> T a -> T b -> T c #

(*>) :: T a -> T b -> T b #

(<*) :: T a -> T b -> T a #

Functor T Source # 
Instance details

Defined in Control.Concurrent.PooledIO.Final

Methods

fmap :: (a -> b) -> T a -> T b #

(<$) :: a -> T b -> T a #

run :: T a -> IO a Source #

runLimited with a maximum of numCapabilites threads.

runLimited :: Int -> T a -> IO a Source #

runLimited n runs several actions in a pool with at most n threads.

fork :: NFData a => IO a -> T a Source #

This runs an action parallelly to the starting thread. Since it is an Applicative Functor and not a Monad, there are no data dependencies between the actions and thus all actions in a T can be run parallelly. Only the IO actions are parallelised but not the combining function passed to liftA2 et.al. That is, the main work must be done in the IO actions in order to benefit from parallelisation.