parallel-3.2.2.0: Parallel programming library

Copyright | (c) The University of Glasgow 2001-2010
License | BSD-style (see the file libraries/base/LICENSE)
Maintainer | libraries@haskell.org
Stability | experimental
Portability | portable
Safe Haskell | None
Language | Haskell2010

Control.Parallel.Strategies

Contents

- The strategy type
- Application of strategies
- Composition of strategies
- Basic strategies
- Injection of sequential strategies
- Strategies for traversable data types
- Strategies for lists
  - Strategies for lazy lists
- Strategies for tuples
- Strategic function application
- For Strategy programmers
- API History
- Backwards compatibility
- For API completeness

Description

Parallel Evaluation Strategies, or Strategies for short, provide ways to express parallel computations. Strategies have the following key features:

- Strategies express deterministic parallelism: the result of the program is unaffected by evaluating in parallel. The parallel tasks evaluated by a Strategy may have no side effects. For non-deterministic parallel programming, see Control.Concurrent.
- Strategies let you separate the description of the parallelism from the logic of your program, enabling modular parallelism. The basic idea is to build a lazy data structure representing the computation, and then write a Strategy that describes how to traverse the data structure and evaluate components of it sequentially or in parallel.
- Strategies are compositional: larger strategies can be built by gluing together smaller ones.
- `Monad` and `Applicative` instances are provided, for quickly building strategies that involve traversing structures in a regular way.

For API history and changes in this release, see Control.Parallel.Strategies.

Synopsis

- type Strategy a = a -> Eval a
- using :: a -> Strategy a -> a
- withStrategy :: Strategy a -> a -> a
- usingIO :: a -> Strategy a -> IO a
- withStrategyIO :: Strategy a -> a -> IO a
- dot :: Strategy a -> Strategy a -> Strategy a
- r0 :: Strategy a
- rseq :: Strategy a
- rdeepseq :: NFData a => Strategy a
- rpar :: Strategy a
- rparWith :: Strategy a -> Strategy a
- evalSeq :: SeqStrategy a -> Strategy a
- type SeqStrategy a = Strategy a
- evalTraversable :: Traversable t => Strategy a -> Strategy (t a)
- parTraversable :: Traversable t => Strategy a -> Strategy (t a)
- evalList :: Strategy a -> Strategy [a]
- parList :: Strategy a -> Strategy [a]
- evalListN :: Int -> Strategy a -> Strategy [a]
- parListN :: Int -> Strategy a -> Strategy [a]
- evalListNth :: Int -> Strategy a -> Strategy [a]
- parListNth :: Int -> Strategy a -> Strategy [a]
- evalListSplitAt :: Int -> Strategy [a] -> Strategy [a] -> Strategy [a]
- parListSplitAt :: Int -> Strategy [a] -> Strategy [a] -> Strategy [a]
- parListChunk :: Int -> Strategy a -> Strategy [a]
- parMap :: Strategy b -> (a -> b) -> [a] -> [b]
- evalBuffer :: Int -> Strategy a -> Strategy [a]
- parBuffer :: Int -> Strategy a -> Strategy [a]
- evalTuple2 :: Strategy a -> Strategy b -> Strategy (a, b)
- evalTuple3 :: Strategy a -> Strategy b -> Strategy c -> Strategy (a, b, c)
- evalTuple4 :: Strategy a -> Strategy b -> Strategy c -> Strategy d -> Strategy (a, b, c, d)
- evalTuple5 :: Strategy a -> Strategy b -> Strategy c -> Strategy d -> Strategy e -> Strategy (a, b, c, d, e)
- evalTuple6 :: Strategy a -> Strategy b -> Strategy c -> Strategy d -> Strategy e -> Strategy f -> Strategy (a, b, c, d, e, f)
- evalTuple7 :: Strategy a -> Strategy b -> Strategy c -> Strategy d -> Strategy e -> Strategy f -> Strategy g -> Strategy (a, b, c, d, e, f, g)
- evalTuple8 :: Strategy a -> Strategy b -> Strategy c -> Strategy d -> Strategy e -> Strategy f -> Strategy g -> Strategy h -> Strategy (a, b, c, d, e, f, g, h)
- evalTuple9 :: Strategy a -> Strategy b -> Strategy c -> Strategy d -> Strategy e -> Strategy f -> Strategy g -> Strategy h -> Strategy i -> Strategy (a, b, c, d, e, f, g, h, i)
- parTuple2 :: Strategy a -> Strategy b -> Strategy (a, b)
- parTuple3 :: Strategy a -> Strategy b -> Strategy c -> Strategy (a, b, c)
- parTuple4 :: Strategy a -> Strategy b -> Strategy c -> Strategy d -> Strategy (a, b, c, d)
- parTuple5 :: Strategy a -> Strategy b -> Strategy c -> Strategy d -> Strategy e -> Strategy (a, b, c, d, e)
- parTuple6 :: Strategy a -> Strategy b -> Strategy c -> Strategy d -> Strategy e -> Strategy f -> Strategy (a, b, c, d, e, f)
- parTuple7 :: Strategy a -> Strategy b -> Strategy c -> Strategy d -> Strategy e -> Strategy f -> Strategy g -> Strategy (a, b, c, d, e, f, g)
- parTuple8 :: Strategy a -> Strategy b -> Strategy c -> Strategy d -> Strategy e -> Strategy f -> Strategy g -> Strategy h -> Strategy (a, b, c, d, e, f, g, h)
- parTuple9 :: Strategy a -> Strategy b -> Strategy c -> Strategy d -> Strategy e -> Strategy f -> Strategy g -> Strategy h -> Strategy i -> Strategy (a, b, c, d, e, f, g, h, i)
- ($|) :: (a -> b) -> Strategy a -> a -> b
- ($||) :: (a -> b) -> Strategy a -> a -> b
- (.|) :: (b -> c) -> Strategy b -> (a -> b) -> a -> c
- (.||) :: (b -> c) -> Strategy b -> (a -> b) -> a -> c
- (-|) :: (a -> b) -> Strategy b -> (b -> c) -> a -> c
- (-||) :: (a -> b) -> Strategy b -> (b -> c) -> a -> c
- data Eval a
- parEval :: Eval a -> Eval a
- runEval :: Eval a -> a
- runEvalIO :: Eval a -> IO a
- type Done = ()
- demanding :: a -> Done -> a
- sparking :: a -> Done -> a
- (>|) :: Done -> Done -> Done
- (>||) :: Done -> Done -> Done
- rwhnf :: Strategy a
- unEval :: Eval a -> a
- seqTraverse :: Traversable t => Strategy a -> Strategy (t a)
- parTraverse :: Traversable t => Strategy a -> Strategy (t a)
- seqList :: Strategy a -> Strategy [a]
- seqPair :: Strategy a -> Strategy b -> Strategy (a, b)
- parPair :: Strategy a -> Strategy b -> Strategy (a, b)
- seqTriple :: Strategy a -> Strategy b -> Strategy c -> Strategy (a, b, c)
- parTriple :: Strategy a -> Strategy b -> Strategy c -> Strategy (a, b, c)
- class NFData a

# The strategy type

type Strategy a = a -> Eval a Source #

A `Strategy` is a function that embodies a parallel evaluation strategy. The function traverses (parts of) its argument, evaluating subexpressions in parallel or in sequence.

A `Strategy` may do an arbitrary amount of evaluation of its argument, but should not return a value different from the one it was passed.

Parallel computations may be discarded by the runtime system if the program no longer requires their result, which is why a `Strategy` function returns a new value equivalent to the old value. The intention is that the program applies the `Strategy` to a structure, and then uses the returned value, discarding the old value. This idiom is expressed by the `using` function.

# Application of strategies

using :: a -> Strategy a -> a infixl 0 Source #

Evaluate a value using the given `Strategy`.

    x `using` s = runEval (s x)

withStrategy :: Strategy a -> a -> a Source #

evaluate a value using the given `Strategy`. This is simply `using` with the arguments reversed.

usingIO :: a -> Strategy a -> IO a infixl 0 Source #

Evaluate a value using the given `Strategy` inside the `IO` monad. See also `runEvalIO`.

    x `usingIO` s = runEvalIO (s x)

withStrategyIO :: Strategy a -> a -> IO a Source #

Evaluate a value using the given `Strategy` inside the `IO` monad. This is simply `usingIO` with the arguments reversed.

# Composition of strategies

dot :: Strategy a -> Strategy a -> Strategy a infixr 9 Source #

Compose two strategies sequentially. This is the analogue to function composition on strategies.

For any strategies `strat1`, `strat2`, and `strat3`,

    (strat1 `dot` strat2) `dot` strat3 == strat1 `dot` (strat2 `dot` strat3)
    strat1 `dot` strat1 = strat1
    strat1 `dot` r0 == strat1

    strat2 `dot` strat1 == strat2 . withStrategy strat1

# Basic strategies

r0 :: Strategy a Source #

`r0` performs *no* evaluation.

    r0 == evalSeq Control.Seq.r0

rseq :: Strategy a Source #

`rseq` evaluates its argument to weak head normal form.

    rseq == evalSeq Control.Seq.rseq

rdeepseq :: NFData a => Strategy a Source #

`rdeepseq` fully evaluates its argument.

    rdeepseq == evalSeq Control.Seq.rdeepseq

rpar :: Strategy a Source #

`rpar` sparks its argument (for evaluation in parallel).

rparWith :: Strategy a -> Strategy a Source #

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.

# Injection of sequential strategies

evalSeq :: SeqStrategy a -> Strategy a Source #

Inject a sequential strategy (ie. coerce a sequential strategy to a general strategy).

Thanks to `evalSeq`, the type `Control.Seq.Strategy a` is a subtype of ``Strategy` a`.

type SeqStrategy a = Strategy a Source #

A name for `Control.Seq.Strategy`, for documentation only.

# Strategies for traversable data types

evalTraversable :: Traversable t => Strategy a -> Strategy (t a) Source #

Evaluate the elements of a traversable data structure according to the given strategy.

parTraversable :: Traversable t => Strategy a -> Strategy (t a) Source #

Like `evalTraversable` but evaluates all elements in parallel.

# Strategies for lists

evalList :: Strategy a -> Strategy [a] Source #

Evaluate each element of a list according to the given strategy. Equivalent to `evalTraversable` at the list type.

parList :: Strategy a -> Strategy [a] Source #

Evaluate each element of a list in parallel according to given strategy. Equivalent to `parTraversable` at the list type.

evalListN :: Int -> Strategy a -> Strategy [a] Source #

Evaluate the first n elements of a list according to the given strategy.

parListN :: Int -> Strategy a -> Strategy [a] Source #

Like `evalListN` but evaluates the first n elements in parallel.

evalListNth :: Int -> Strategy a -> Strategy [a] Source #

Evaluate the nth element of a list (if there is such) according to the given strategy. This nth is 0-based. For example, `[1, 2, 3, 4, 5] `using` evalListNth 4 rseq` will eval `5`, not `4`. The spine of the list up to the nth element is evaluated as a side effect.

parListNth :: Int -> Strategy a -> Strategy [a] Source #

Like `evalListN` but evaluates the nth element in parallel.

evalListSplitAt :: Int -> Strategy [a] -> Strategy [a] -> Strategy [a] Source #

``evaListSplitAt` n stratPref stratSuff` evaluates the prefix (of length `n`) of a list according to `stratPref` and its the suffix according to `stratSuff`.

parListSplitAt :: Int -> Strategy [a] -> Strategy [a] -> Strategy [a] Source #

Like `evalListSplitAt` but evaluates both sublists in parallel.

parListChunk :: Int -> Strategy a -> Strategy [a] Source #

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`

parMap :: Strategy b -> (a -> b) -> [a] -> [b] Source #

A combination of `parList` and `map`, encapsulating a common pattern:

    parMap strat f = withStrategy (parList strat) . map f

## Strategies for lazy lists

evalBuffer :: Int -> Strategy a -> Strategy [a] Source #

`evalBuffer` is a rolling buffer strategy combinator for (lazy) lists.

`evalBuffer` is not as compositional as the type suggests. In fact, it evaluates list elements at least to weak head normal form, disregarding a strategy argument `r0`.

    evalBuffer n r0 == evalBuffer n rseq

parBuffer :: Int -> Strategy a -> Strategy [a] Source #

Like `evalBuffer` but evaluates the list elements in parallel when pushing them into the buffer.

# Strategies for tuples

Evaluate the components of a tuple according to the given strategies.

evalTuple2 :: Strategy a -> Strategy b -> Strategy (a, b) Source #

evalTuple3 :: Strategy a -> Strategy b -> Strategy c -> Strategy (a, b, c) Source #

evalTuple4 :: Strategy a -> Strategy b -> Strategy c -> Strategy d -> Strategy (a, b, c, d) Source #

evalTuple5 :: Strategy a -> Strategy b -> Strategy c -> Strategy d -> Strategy e -> Strategy (a, b, c, d, e) Source #

evalTuple6 :: Strategy a -> Strategy b -> Strategy c -> Strategy d -> Strategy e -> Strategy f -> Strategy (a, b, c, d, e, f) Source #

evalTuple7 :: Strategy a -> Strategy b -> Strategy c -> Strategy d -> Strategy e -> Strategy f -> Strategy g -> Strategy (a, b, c, d, e, f, g) Source #

evalTuple8 :: Strategy a -> Strategy b -> Strategy c -> Strategy d -> Strategy e -> Strategy f -> Strategy g -> Strategy h -> Strategy (a, b, c, d, e, f, g, h) Source #

evalTuple9 :: Strategy a -> Strategy b -> Strategy c -> Strategy d -> Strategy e -> Strategy f -> Strategy g -> Strategy h -> Strategy i -> Strategy (a, b, c, d, e, f, g, h, i) Source #

Evaluate the components of a tuple in parallel according to the given strategies.

parTuple2 :: Strategy a -> Strategy b -> Strategy (a, b) Source #

parTuple3 :: Strategy a -> Strategy b -> Strategy c -> Strategy (a, b, c) Source #

parTuple4 :: Strategy a -> Strategy b -> Strategy c -> Strategy d -> Strategy (a, b, c, d) Source #

parTuple5 :: Strategy a -> Strategy b -> Strategy c -> Strategy d -> Strategy e -> Strategy (a, b, c, d, e) Source #

parTuple6 :: Strategy a -> Strategy b -> Strategy c -> Strategy d -> Strategy e -> Strategy f -> Strategy (a, b, c, d, e, f) Source #

parTuple7 :: Strategy a -> Strategy b -> Strategy c -> Strategy d -> Strategy e -> Strategy f -> Strategy g -> Strategy (a, b, c, d, e, f, g) Source #

parTuple8 :: Strategy a -> Strategy b -> Strategy c -> Strategy d -> Strategy e -> Strategy f -> Strategy g -> Strategy h -> Strategy (a, b, c, d, e, f, g, h) Source #

parTuple9 :: Strategy a -> Strategy b -> Strategy c -> Strategy d -> Strategy e -> Strategy f -> Strategy g -> Strategy h -> Strategy i -> Strategy (a, b, c, d, e, f, g, h, i) Source #

# Strategic function application

($|) :: (a -> b) -> Strategy a -> a -> b Source #

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

($||) :: (a -> b) -> Strategy a -> a -> b Source #

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

(.|) :: (b -> c) -> Strategy b -> (a -> b) -> a -> c Source #

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

(.||) :: (b -> c) -> Strategy b -> (a -> b) -> a -> c Source #

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

(-|) :: (a -> b) -> Strategy b -> (b -> c) -> a -> c Source #

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.

(-||) :: (a -> b) -> Strategy b -> (b -> c) -> a -> c Source #

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.

# For Strategy programmers

data Eval a Source #

`Eval` is a Monad that makes it easier to define parallel strategies. It is a strict identity monad: that is, in

    m >>= f

`m` is evaluated before the result is passed to `f`.

    instance Monad Eval where
      return  = Done
      m >>= k = case m of
                  Done x -> k x

If you wanted to construct a `Strategy` for a pair that sparked the first component in parallel and then evaluated the second component, you could write

    myStrat :: Strategy (a,b)
    myStrat (a,b) = do { a' <- rpar a; b' <- rseq b; return (a',b') }

Alternatively, you could write this more compactly using the Applicative style as

    myStrat (a,b) = (,) <$> rpar a <*> rseq b

#### Instances

Instances details

Applicative Eval Source # |
Instance details Defined in Control.Parallel.Strategies Methods pure :: a -> Eval a Source # (<*>) :: Eval (a -> b) -> Eval a -> Eval b Source # liftA2 :: (a -> b -> c) -> Eval a -> Eval b -> Eval c Source # (*>) :: Eval a -> Eval b -> Eval b Source # (<*) :: Eval a -> Eval b -> Eval a Source #
Functor Eval Source # |
Instance details Defined in Control.Parallel.Strategies Methods fmap :: (a -> b) -> Eval a -> Eval b Source # (<$) :: a -> Eval b -> Eval a Source #
Monad Eval Source # |
Instance details Defined in Control.Parallel.Strategies Methods (>>=) :: Eval a -> (a -> Eval b) -> Eval b Source # (>>) :: Eval a -> Eval b -> Eval b Source # return :: a -> Eval a Source #
MonadFix Eval Source # |
Instance details Defined in Control.Parallel.Strategies Methods mfix :: (a -> Eval a) -> Eval a Source #

parEval :: Eval a -> Eval a Source #

`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

runEval :: Eval a -> a Source #

Pull the result out of the monad.

runEvalIO :: Eval a -> IO a Source #

Run the evaluation in the `IO` monad. This allows sequencing of evaluations relative to `IO` actions.

# API History

The strategies library has a long history. What follows is a summary of how the current design evolved, and is mostly of interest to those who are familiar with an older version, or need to adapt old code to use the newer API.

Version 1.x

The original Strategies design is described in Algorithm + Strategy = Parallelism http://www.macs.hw.ac.uk/~dsg/gph/papers/html/Strategies/strategies.html and the code was written by Phil Trinder, Hans-Wolfgang Loidl, Kevin Hammond et al.

Version 2.x

Later, during work on the shared-memory implementation of parallelism in GHC, we discovered that the original formulation of Strategies had some problems, in particular it lead to space leaks and difficulties expressing speculative parallelism. Details are in the paper Runtime Support for Multicore Haskell http://community.haskell.org/~simonmar/papers/multicore-ghc.pdf.

This module has been rewritten in version 2. The main change is to the 'Strategy a' type synonym, which was previously `a -> Done` and is now `a -> Eval a`. This change helps to fix the space leak described in "Runtime Support for Multicore Haskell". The problem is that the runtime will currently retain the memory referenced by all sparks, until they are evaluated. Hence, we must arrange to evaluate all the sparks eventually, just in case they aren't evaluated in parallel, so that they don't cause a space leak. This is why we must return a "new" value after applying a `Strategy`, so that the application can evaluate each spark created by the `Strategy`.

The simple rule is this: you must use the result of applying a `Strategy` if the strategy creates parallel sparks, and you should probably discard the the original value. If you don't do this, currently it may result in a space leak. In the future (GHC 6.14), it will probably result in lost parallelism instead, as we plan to change GHC so that unreferenced sparks are discarded rather than retained (we can't make this change until most code is switched over to this new version of Strategies, because code using the old verison of Strategies would be broken by the change in policy).

The other changes in version 2.x are:

- Strategies can now be defined using a convenient Monad/Applicative type, `Eval`. e.g. `parList s = traverse (Par . (``using`` s))`
- `parList` has been generalised to `parTraverse`, which works on any `Traversable` type, and similarly `seqList` has been generalised to `seqTraverse`
- `parList` and `parBuffer` have versions specialised to `rwhnf`, and there are transformation rules that automatically translate e.g. `parList rwnhf` into a call to the optimised version.
- `NFData` has been moved to `Control.DeepSeq` in the `deepseq` package. Note that since the `Strategy` type changed, `rnf` is no longer a `Strategy`: use `rdeepseq` instead.

Version 2.1 moved NFData into a separate package, `deepseq`.

Version 2.2 changed the type of Strategy to `a -> Eval a`, and re-introduced the `r0` strategy which was missing in version 2.1.

Version 2.3 simplified the `Eval` type, so that `Eval` is now just the strict identity monad. This change and various other improvements and refactorings are thanks to Patrick Maier who noticed that `Eval` didn't satisfy the monad laws, and that a simpler version would fix that problem.

(version 2.3 was not released on Hackage).

Version 3 introduced a major overhaul of the API, to match what is presented in the paper

Seq no More: Better Strategies for Parallel Haskell http://community.haskell.org/~simonmar/papers/strategies.pdf

The major differences in the API are:

- The addition of Sequential strategies (Control.Seq) as a composable means for specifying sequential evaluation.
- Changes to the naming scheme: `rwhnf` renamed to `rseq`, `seqList` renamed to `evalList`, `seqPair` renamed to `evalTuple2`,

The naming scheme is now as follows:

- Basic polymorphic strategies (of type ``Strategy` a`) are called `r...`. Examples: `r0`, `rseq`, `rpar`, `rdeepseq`.
- A strategy combinator for a particular type constructor or constructor class `T` is called `evalT...`, `parT...` or `seqT...`.
- The `seqT...` combinators (residing in module Control.Seq) yield sequential strategies. Thus, `seqT...` combinators cannot spark, nor can the sequential strategies to which they may be applied. Examples: `seqTuple2`, `seqListN`, `seqFoldable`.
- The `evalT...` combinators do not spark themselves, yet they may be applied to strategies that do spark. (They may also be applied to non-sparking strategies; however, in that case the corresponding `seqT...` combinator might be a better choice.) Examples: `evalTuple2`, `evalListN`, `evalTraversable`.
- The `parT...` combinators, which are derived from their `evalT...` counterparts, do spark. They may be applied to all strategies, whether sparking or not. Examples: `parTuple2`, `parListN`, `parTraversable`.
- An exception to the type driven naming scheme are `evalBuffer` and `parBuffer`, which are not named after their type constructor (lists) but after their function (rolling buffer of fixed size).

# Backwards compatibility

These functions and types are all deprecated, and will be removed in a future release. In all cases they have been either renamed or replaced with equivalent functionality.

type Done = () Source #

Deprecated: The Strategy type is now a -> Eval a, not a -> Done

DEPRECCATED: replaced by the `Eval` monad

demanding :: a -> Done -> a Source #

Deprecated: Use pseq or $| instead

DEPRECATED: Use `pseq` or `$|` instead

sparking :: a -> Done -> a Source #

Deprecated: Use par or $|| instead

DEPRECATED: Use `par` or `$||` instead

(>|) :: Done -> Done -> Done Source #

Deprecated: Use pseq or $| instead

DEPRECATED: Use `pseq` or `$|` instead

(>||) :: Done -> Done -> Done Source #

Deprecated: Use par or $|| instead

DEPRECATED: Use `par` or `$||` instead

rwhnf :: Strategy a Source #

Deprecated: renamed to rseq

DEPRECATED: renamed to `rseq`

unEval :: Eval a -> a Source #

Deprecated: renamed to runEval

DEPRECATED: renamed to `runEval`

seqTraverse :: Traversable t => Strategy a -> Strategy (t a) Source #

Deprecated: renamed to evalTraversable

DEPRECATED: renamed to `evalTraversable`

parTraverse :: Traversable t => Strategy a -> Strategy (t a) Source #

Deprecated: renamed to parTraversable

DEPRECATED: renamed to `parTraversable`

seqList :: Strategy a -> Strategy [a] Source #

Deprecated: renamed to evalList

DEPRECATED: renamed to `evalList`

seqPair :: Strategy a -> Strategy b -> Strategy (a, b) Source #

Deprecated: renamed to evalTuple2

DEPRECATED: renamed to `evalTuple2`

parPair :: Strategy a -> Strategy b -> Strategy (a, b) Source #

Deprecated: renamed to parTuple2

DEPRECATED: renamed to `parTuple2`

seqTriple :: Strategy a -> Strategy b -> Strategy c -> Strategy (a, b, c) Source #

Deprecated: renamed to evalTuple3

DEPRECATED: renamed to `evalTuple3`

parTriple :: Strategy a -> Strategy b -> Strategy c -> Strategy (a, b, c) Source #

Deprecated: renamed to parTuple3

DEPRECATED: renamed to `parTuple3`

# For API completeness

so users of `rdeepseq` aren't required to import Control.DeepSeq:

class NFData a Source #

A class of types that can be fully evaluated.

Since: deepseq-1.1.0.0

#### Instances

Instances details

NFData ByteArray | Since: deepseq-1.4.7.0
Instance details Defined in Control.DeepSeq Methods rnf :: ByteArray -> () Source #
NFData IntSet |
Instance details Defined in Data.IntSet.Internal Methods rnf :: IntSet -> () Source #
NFData Void | Defined as ``rnf` = `absurd``. Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: Void -> () Source #
NFData ThreadId | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: ThreadId -> () Source #
NFData All | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: All -> () Source #
NFData Any | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: Any -> () Source #
NFData TypeRep | NOTE: Prior to `deepseq-1.4.4.0` this instance was only defined for `base-4.8.0.0` and later. Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: TypeRep -> () Source #
NFData Unique | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: Unique -> () Source #
NFData Version | Since: deepseq-1.3.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: Version -> () Source #
NFData Fingerprint | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: Fingerprint -> () Source #
NFData CBool | Since: deepseq-1.4.3.0
Instance details Defined in Control.DeepSeq Methods rnf :: CBool -> () Source #
NFData CChar | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: CChar -> () Source #
NFData CClock | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: CClock -> () Source #
NFData CDouble | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: CDouble -> () Source #
NFData CFile | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: CFile -> () Source #
NFData CFloat | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: CFloat -> () Source #
NFData CFpos | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: CFpos -> () Source #
NFData CInt | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: CInt -> () Source #
NFData CIntMax | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: CIntMax -> () Source #
NFData CIntPtr | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: CIntPtr -> () Source #
NFData CJmpBuf | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: CJmpBuf -> () Source #
NFData CLLong | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: CLLong -> () Source #
NFData CLong | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: CLong -> () Source #
NFData CPtrdiff | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: CPtrdiff -> () Source #
NFData CSChar | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: CSChar -> () Source #
NFData CSUSeconds | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: CSUSeconds -> () Source #
NFData CShort | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: CShort -> () Source #
NFData CSigAtomic | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: CSigAtomic -> () Source #
NFData CSize | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: CSize -> () Source #
NFData CTime | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: CTime -> () Source #
NFData CUChar | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: CUChar -> () Source #
NFData CUInt | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: CUInt -> () Source #
NFData CUIntMax | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: CUIntMax -> () Source #
NFData CUIntPtr | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: CUIntPtr -> () Source #
NFData CULLong | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: CULLong -> () Source #
NFData CULong | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: CULong -> () Source #
NFData CUSeconds | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: CUSeconds -> () Source #
NFData CUShort | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: CUShort -> () Source #
NFData CWchar | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: CWchar -> () Source #
NFData MaskingState | Since: deepseq-1.4.4.0
Instance details Defined in Control.DeepSeq Methods rnf :: MaskingState -> () Source #
NFData ExitCode | Since: deepseq-1.4.2.0
Instance details Defined in Control.DeepSeq Methods rnf :: ExitCode -> () Source #
NFData Int16 |
Instance details Defined in Control.DeepSeq Methods rnf :: Int16 -> () Source #
NFData Int32 |
Instance details Defined in Control.DeepSeq Methods rnf :: Int32 -> () Source #
NFData Int64 |
Instance details Defined in Control.DeepSeq Methods rnf :: Int64 -> () Source #
NFData Int8 |
Instance details Defined in Control.DeepSeq Methods rnf :: Int8 -> () Source #
NFData CallStack | Since: deepseq-1.4.2.0
Instance details Defined in Control.DeepSeq Methods rnf :: CallStack -> () Source #
NFData SrcLoc | Since: deepseq-1.4.2.0
Instance details Defined in Control.DeepSeq Methods rnf :: SrcLoc -> () Source #
NFData Word16 |
Instance details Defined in Control.DeepSeq Methods rnf :: Word16 -> () Source #
NFData Word32 |
Instance details Defined in Control.DeepSeq Methods rnf :: Word32 -> () Source #
NFData Word64 |
Instance details Defined in Control.DeepSeq Methods rnf :: Word64 -> () Source #
NFData Word8 |
Instance details Defined in Control.DeepSeq Methods rnf :: Word8 -> () Source #
NFData Module | Since: deepseq-1.4.8.0
Instance details Defined in Control.DeepSeq Methods rnf :: Module -> () Source #
NFData Ordering |
Instance details Defined in Control.DeepSeq Methods rnf :: Ordering -> () Source #
NFData TyCon | NOTE: Prior to `deepseq-1.4.4.0` this instance was only defined for `base-4.8.0.0` and later. Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: TyCon -> () Source #
NFData Integer |
Instance details Defined in Control.DeepSeq Methods rnf :: Integer -> () Source #
NFData Natural | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: Natural -> () Source #
NFData () |
Instance details Defined in Control.DeepSeq Methods rnf :: () -> () Source #
NFData Bool |
Instance details Defined in Control.DeepSeq Methods rnf :: Bool -> () Source #
NFData Char |
Instance details Defined in Control.DeepSeq Methods rnf :: Char -> () Source #
NFData Double |
Instance details Defined in Control.DeepSeq Methods rnf :: Double -> () Source #
NFData Float |
Instance details Defined in Control.DeepSeq Methods rnf :: Float -> () Source #
NFData Int |
Instance details Defined in Control.DeepSeq Methods rnf :: Int -> () Source #
NFData Word |
Instance details Defined in Control.DeepSeq Methods rnf :: Word -> () Source #
NFData (MutableByteArray s) | Since: deepseq-1.4.8.0
Instance details Defined in Control.DeepSeq Methods rnf :: MutableByteArray s -> () Source #
NFData a => NFData (Complex a) |
Instance details Defined in Control.DeepSeq Methods rnf :: Complex a -> () Source #
NFData a => NFData (First a) | Since: deepseq-1.4.2.0
Instance details Defined in Control.DeepSeq Methods rnf :: First a -> () Source #
NFData a => NFData (Last a) | Since: deepseq-1.4.2.0
Instance details Defined in Control.DeepSeq Methods rnf :: Last a -> () Source #
NFData a => NFData (Max a) | Since: deepseq-1.4.2.0
Instance details Defined in Control.DeepSeq Methods rnf :: Max a -> () Source #
NFData a => NFData (Min a) | Since: deepseq-1.4.2.0
Instance details Defined in Control.DeepSeq Methods rnf :: Min a -> () Source #
NFData m => NFData (WrappedMonoid m) | Since: deepseq-1.4.2.0
Instance details Defined in Control.DeepSeq Methods rnf :: WrappedMonoid m -> () Source #
NFData a => NFData (SCC a) |
Instance details Defined in Data.Graph Methods rnf :: SCC a -> () Source #
NFData a => NFData (IntMap a) |
Instance details Defined in Data.IntMap.Internal Methods rnf :: IntMap a -> () Source #
NFData a => NFData (Digit a) |
Instance details Defined in Data.Sequence.Internal Methods rnf :: Digit a -> () Source #
NFData a => NFData (Elem a) |
Instance details Defined in Data.Sequence.Internal Methods rnf :: Elem a -> () Source #
NFData a => NFData (FingerTree a) |
Instance details Defined in Data.Sequence.Internal Methods rnf :: FingerTree a -> () Source #
NFData a => NFData (Node a) |
Instance details Defined in Data.Sequence.Internal Methods rnf :: Node a -> () Source #
NFData a => NFData (Seq a) |
Instance details Defined in Data.Sequence.Internal Methods rnf :: Seq a -> () Source #
NFData a => NFData (Set a) |
Instance details Defined in Data.Set.Internal Methods rnf :: Set a -> () Source #
NFData a => NFData (Tree a) |
Instance details Defined in Data.Tree Methods rnf :: Tree a -> () Source #
NFData a => NFData (NonEmpty a) | Since: deepseq-1.4.2.0
Instance details Defined in Control.DeepSeq Methods rnf :: NonEmpty a -> () Source #
NFData a => NFData (Identity a) | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: Identity a -> () Source #
NFData a => NFData (First a) | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: First a -> () Source #
NFData a => NFData (Last a) | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: Last a -> () Source #
NFData a => NFData (Down a) | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: Down a -> () Source #
NFData a => NFData (Dual a) | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: Dual a -> () Source #
NFData a => NFData (Product a) | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: Product a -> () Source #
NFData a => NFData (Sum a) | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: Sum a -> () Source #
NFData a => NFData (ZipList a) | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: ZipList a -> () Source #
NFData (IORef a) | NOTE: Only strict in the reference and not the referenced value. Since: deepseq-1.4.2.0
Instance details Defined in Control.DeepSeq Methods rnf :: IORef a -> () Source #
NFData (MVar a) | NOTE: Only strict in the reference and not the referenced value. Since: deepseq-1.4.2.0
Instance details Defined in Control.DeepSeq Methods rnf :: MVar a -> () Source #
NFData (FunPtr a) | Since: deepseq-1.4.2.0
Instance details Defined in Control.DeepSeq Methods rnf :: FunPtr a -> () Source #
NFData (Ptr a) | Since: deepseq-1.4.2.0
Instance details Defined in Control.DeepSeq Methods rnf :: Ptr a -> () Source #
NFData a => NFData (Ratio a) |
Instance details Defined in Control.DeepSeq Methods rnf :: Ratio a -> () Source #
NFData (StableName a) | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: StableName a -> () Source #
NFData a => NFData (Maybe a) |
Instance details Defined in Control.DeepSeq Methods rnf :: Maybe a -> () Source #
NFData a => NFData (Solo a) | Since: deepseq-1.4.6.0
Instance details Defined in Control.DeepSeq Methods rnf :: Solo a -> () Source #
NFData a => NFData [a] |
Instance details Defined in Control.DeepSeq Methods rnf :: [a] -> () Source #
NFData (Fixed a) | Since: deepseq-1.3.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: Fixed a -> () Source #
(NFData a, NFData b) => NFData (Arg a b) | Since: deepseq-1.4.2.0
Instance details Defined in Control.DeepSeq Methods rnf :: Arg a b -> () Source #
(NFData k, NFData a) => NFData (Map k a) |
Instance details Defined in Data.Map.Internal Methods rnf :: Map k a -> () Source #
(NFData a, NFData b) => NFData (Array a b) |
Instance details Defined in Control.DeepSeq Methods rnf :: Array a b -> () Source #
(NFData a, NFData b) => NFData (Either a b) |
Instance details Defined in Control.DeepSeq Methods rnf :: Either a b -> () Source #
NFData (Proxy a) | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: Proxy a -> () Source #
NFData (TypeRep a) | Since: deepseq-1.4.8.0
Instance details Defined in Control.DeepSeq Methods rnf :: TypeRep a -> () Source #
NFData (STRef s a) | NOTE: Only strict in the reference and not the referenced value. Since: deepseq-1.4.2.0
Instance details Defined in Control.DeepSeq Methods rnf :: STRef s a -> () Source #
(NFData a, NFData b) => NFData (a, b) |
Instance details Defined in Control.DeepSeq Methods rnf :: (a, b) -> () Source #
NFData (a -> b) | This instance is for convenience and consistency with `seq`. This assumes that WHNF is equivalent to NF for functions. Since: deepseq-1.3.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: (a -> b) -> () Source #
NFData a => NFData (Const a b) | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: Const a b -> () Source #
NFData (a :~: b) | Since: deepseq-1.4.3.0
Instance details Defined in Control.DeepSeq Methods rnf :: (a :~: b) -> () Source #
(NFData a1, NFData a2, NFData a3) => NFData (a1, a2, a3) |
Instance details Defined in Control.DeepSeq Methods rnf :: (a1, a2, a3) -> () Source #
(NFData (f a), NFData (g a)) => NFData (Product f g a) | Note: in `deepseq-1.5.0.0` this instance's superclasses were changed. Since: deepseq-1.4.3.0
Instance details Defined in Control.DeepSeq Methods rnf :: Product f g a -> () Source #
(NFData (f a), NFData (g a)) => NFData (Sum f g a) | Note: in `deepseq-1.5.0.0` this instance's superclasses were changed. Since: deepseq-1.4.3.0
Instance details Defined in Control.DeepSeq Methods rnf :: Sum f g a -> () Source #
NFData (a :~~: b) | Since: deepseq-1.4.3.0
Instance details Defined in Control.DeepSeq Methods rnf :: (a :~~: b) -> () Source #
(NFData a1, NFData a2, NFData a3, NFData a4) => NFData (a1, a2, a3, a4) |
Instance details Defined in Control.DeepSeq Methods rnf :: (a1, a2, a3, a4) -> () Source #
NFData (f (g a)) => NFData (Compose f g a) | Note: in `deepseq-1.5.0.0` this instance's superclasses were changed. Since: deepseq-1.4.3.0
Instance details Defined in Control.DeepSeq Methods rnf :: Compose f g a -> () Source #
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5) => NFData (a1, a2, a3, a4, a5) |
Instance details Defined in Control.DeepSeq Methods rnf :: (a1, a2, a3, a4, a5) -> () Source #
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6) => NFData (a1, a2, a3, a4, a5, a6) |
Instance details Defined in Control.DeepSeq Methods rnf :: (a1, a2, a3, a4, a5, a6) -> () Source #
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6, NFData a7) => NFData (a1, a2, a3, a4, a5, a6, a7) |
Instance details Defined in Control.DeepSeq Methods rnf :: (a1, a2, a3, a4, a5, a6, a7) -> () Source #
(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) |
Instance details Defined in Control.DeepSeq Methods rnf :: (a1, a2, a3, a4, a5, a6, a7, a8) -> () Source #
(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) |
Instance details Defined in Control.DeepSeq Methods rnf :: (a1, a2, a3, a4, a5, a6, a7, a8, a9) -> () Source #