par package:parallel

Indicates that it may be beneficial to evaluate the first argument in parallel with the second. Returns the value of the second argument. a `par` b is exactly equivalent semantically to b. par is generally used when the value of a is likely to be required later, but not immediately. Also it is a good idea to ensure that a is not a trivial computation, otherwise the cost of spawning it in parallel overshadows the benefits obtained by running it in parallel. Note that actual parallelism is only supported by certain implementations (GHC with the -threaded option, and GPH, for now). On other implementations, par a b = b.
Parallel programming library This package provides a library for parallel programming. For documentation start from the Control.Parallel.Strategies module below. For more tutorial documentation, see the book Parallel and Concurrent Programming in Haskell. To understand the principles behind the library, see Seq no more: Better Strategies for Parallel Haskell.
Like evalBuffer but evaluates the list elements in parallel when pushing them into the buffer.
parEval sparks the computation of its argument for evaluation in parallel. Unlike rpar . runEval, parEval
  • does not exit the Eval monad
  • does not have a built-in rseq, so for example parEval (r0 x) behaves as you might expect (it creates a spark that does no evaluation).
It is related to rparWith by the following equality:
parEval . strat = rparWith strat
Evaluate each element of a list in parallel according to given strategy. Equivalent to parTraversable at the list type.
Divides a list into chunks, and applies the strategy evalList strat to each chunk in parallel. It is expected that this function will be replaced by a more generic clustering infrastructure in the future. If the chunk size is 1 or less, parListChunk is equivalent to parList
Like evalListN but evaluates the first n elements in parallel.
Like evalListN but evaluates the nth element in parallel.
Like evalListSplitAt but evaluates both sublists in parallel.
A combination of parList and map, encapsulating a common pattern:
parMap strat f = withStrategy (parList strat) . map f
Deprecated: renamed to parTuple2
Like evalTraversable but evaluates all elements in parallel.
Deprecated: renamed to parTraversable
Deprecated: renamed to parTuple3
Parallel Constructs
rpar sparks its argument (for evaluation in parallel).
Perform a computation in parallel using a strategy.
rparWith strat x
will spark strat x. Note that rparWith strat is not the same as rpar dot strat. Specifically, rpar dot strat always sparks a computation to reduce the result of the strategic computation to WHNF, while rparWith strat need not.
rparWith r0 = r0
rparWith rpar = rpar
rparWith rseq = rpar
rparWith rpar x creates a spark that immediately creates another spark to evaluate x. We consider this equivalent to rpar because there isn't any real additional parallelism. However, it is always less efficient because there's a bit of extra work to create the first (useless) spark. Similarly, rparWith r0 creates a spark that does precisely nothing. No real parallelism is added, but there is a bit of extra work to do nothing.