The parallel package provides Haskell primitives for parallel evaluation. Its Eval monad and runEval control computations, while sparks let the runtime schedule work across execution contexts. section 13.4.3
Use the package through several related mechanisms:
- Create a spark with rpar; because it returns without waiting, the spark may fizzle if its value is demanded too soon. section 13.4.3
- Force a value with rseq, then apply strategies such as evalList, using, or withStrategy to parallelize data structures. section 13.4.3
Parallel mapping
map (^ 100) [1 .. 1000] `using` evalList rpar applies a strategy to each list element. The same strategy can be written with withStrategy.
