liveBook · Manning

evalList

As explained in Learn Haskell by Example

evalList is a strategy combinator that applies an element strategy to the elements of a list.

evalList is a strategy combinator that turns an element strategy into a strategy for an entire list. Its type is Strategy a -> Strategy [a]. section 13.4.3

Use it with using or withStrategy to evaluate mapped list elements in parallel. This is especially useful when each mapping operation is expensive. section 13.4.3

Parallel list mapping

The expression map (^ 100) [1 .. 1000] `using` evalList rpar applies rpar to each mapped element, creating parallel evaluation sparks. section 13.4.3

How Learn Haskell by Example covers it

How deep it goes
Defines the type and demonstrates application, but defers chunking and Traversable structures to other strategies.
Examples
Uses an exponentiation map over integers and contrasts using with the equivalent withStrategy form.
What it assumes
Assumes lists, mapping, strategies, and rpar; demonstrates strategy application through complete expressions.
What you can do after
Apply it via Control.Parallel.Strategies to parallelize list computations with an element strategy.
How it connects
Connects Strategy, rpar, using, withStrategy, parallel evaluation, and evalTraversable.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn Haskell by Example. The section links point to the parts of the book it draws on.