
Control.Parallel.Strategies  Portability  nonportable  Stability  experimental  Maintainer  libraries@haskell.org 





Description 
Parallel strategy combinators. See
http://www.macs.hw.ac.uk/~dsg/gph/papers/html/Strategies/strategies.html
for more information.
Original authors:
Phil Trinder, HansWolfgang Loidl, Kevin Hammond et al.


Synopsis 




Strategy Type, Application and Semantics





A strategy takes a value and returns a Done value to indicate that
the specifed evaluation has been performed.



Evaluates the first argument before the second.



Evaluates the first argument in parallel with the second.



Takes a value and a strategy, and applies the strategy to the
value before returning the value. Used to express dataoriented
parallelism. x `using` s is a projection on x, i.e. both:
 a retraction
 x `using` s ⊑ x
 idempotent
 (x `using` s) `using` s = x `using` s



Evaluates the second argument before the first.
Used to express controloriented parallelism. The second
argument is usually a strategy application.



Evaluates the second argument in parallel with the first.
Used to express controloriented
parallelism. The second argument is usually a strategy application.


Basic Strategies



Performs no evaluation of its argument.



Reduces its argument to weak head normal form.



 Methods   Reduces its argument to (head) normal form.

  Instances  NFData Bool  NFData Char  NFData Double  NFData Float  NFData Int  NFData Int16  NFData Int32  NFData Int64  NFData Int8  NFData IntSet  NFData Integer  NFData Word16  NFData Word32  NFData Word64  NFData Word8  NFData ()  (NFData a, NFData b) => NFData (a, b)  (NFData a, NFData b, NFData c) => NFData (a, b, c)  (NFData a, NFData b, NFData c, NFData d) => NFData (a, b, c, d)  (NFData a1, NFData a2, NFData a3, NFData a4, NFData a5) => NFData (a1, a2, a3, a4, a5)  (NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6) => NFData (a1, a2, a3, a4, a5, a6)  (NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6, NFData a7) => NFData (a1, a2, a3, a4, a5, a6, a7)  (NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6, NFData a7, NFData a8) => NFData (a1, a2, a3, a4, a5, a6, a7, a8)  (NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6, NFData a7, NFData a8, NFData a9) => NFData (a1, a2, a3, a4, a5, a6, a7, a8, a9)  (RealFloat a, NFData a) => NFData (Complex a)  NFData a => NFData (IntMap a)  NFData a => NFData (Maybe a)  (Integral a, NFData a) => NFData (Ratio a)  NFData a => NFData (Set a)  NFData a => NFData (Tree a)  NFData a => NFData [a]  (Ix a, NFData a, NFData b) => NFData (Array a b)  (NFData a, NFData b) => NFData (Assoc a b)  (NFData a, NFData b) => NFData (Either a b)  (NFData k, NFData a) => NFData (Map k a) 



Strategic Function Application



Sequential function application. The argument is evaluated using
the given strategy before it is given to the function.



Parallel function application. The argument is evaluated using
the given strategy, in parallel with the function application.



Sequential function composition. The result of
the second function is evaluated using the given strategy,
and then given to the first function.



Parallel function composition. The result of the second
function is evaluated using the given strategy,
in parallel with the application of the first function.



Sequential inverse function composition,
for those who read their programs from left to right.
The result of the first function is evaluated using the
given strategy, and then given to the second function.



Parallel inverse function composition,
for those who read their programs from left to right.
The result of the first function is evaluated using the
given strategy, in parallel with the application of the
second function.


Tuples



Apply two strategies to the elements of a pair sequentially
from left to right.



Apply two strategies to the elements of a pair in parallel.



Apply three strategies to the elements of a triple in sequentially
from left to right.



Apply three strategies to the elements of a triple in parallel.


Lists: Parallel Strategies



Applies a strategy to every element of a list in parallel.



Applies a strategy to the first n elements of a list in parallel.



Evaluates n elements of the spine of the argument list and applies
the given strategy to the nth element (if there is one) in parallel with
the result. E.g. parListNth 2 [e1, e2, e3] evaluates e3.



Splits a list into chunks (subsequences) of length n,
and applies a strategy sequentially to the elements in each
chunk. The chunks are evaluated in parallel.
This is useful for increasing the grain size.



Applies a function to each element of a list and
and evaluates the result list in parallel,
using the given strategy for each element.



Uses parMap to apply a listvalued function to each
element of a list in parallel, and concatenates the results.



Zips together two lists using a function,
and evaluates the result list in parallel.


Lists: Sequential Strategies



Sequentially applies a strategy to each element of a list.



Sequentially applies a strategy to the first n elements of a list.



Applies a strategy to the nth element of a list
(if there is one) before returning the result.
E.g. seqListNth 2 [e1, e2, e3] evaluates e3.



Parallel nbuffer function added for the revised version of the strategies
paper. parBuffer supersedes the older fringeList. It has the same
semantics.


Arrays



Apply a strategy to all elements of an array sequentially.



Apply a strategy to all elements of an array in parallel.


Deprecated types and functions



A strategy corresponding to par:
x `par` e = e `using` sPar x.
sPar has been superceded by sparking.
Replace e `using` sPar x with e `sparking` rwhnf x.



A strategy corresponding to seq:
x `seq` e = e `using` sSeq x.
sSeq has been superceded by demanding.
Replace e `using` sSeq x with e `demanding` rwhnf x.



Constructors   Instances  








Produced by Haddock version 0.8 