Safe Haskell | None |
---|---|

Language | Haskell2010 |

This is a parallel version of Data.TreeFold: all the functions here take
a `Strategy`

which specifies how to evaluate the
fold in parallel, and a number for the size of the chunks evaluated in
parallel. The number works like this. If you imagine the treefold as being
executed on a list of 32 elements like so:

5_______________________________________________________________ /\ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ 4________________/______________________________\_______________ /\ /\ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ 3________/______________\________________/______________\_______ /\ /\ /\ /\ / \ / \ / \ / \ / \ / \ / \ / \ 2____/______\________/______\________/______\________/______\___ /\ /\ /\ /\ /\ /\ /\ /\ 1__/__\____/__\____/__\____/__\____/__\____/__\____/__\____/__\_ 0_/\__/\__/\__/\__/\__/\__/\__/\__/\__/\__/\__/\__/\__/\__/\__/\

Depending on what number you supply, the tree fold will run lazily until it gets to the corresponding point in the diagram above. Then, it will evaluate the subtrees in parallel according to the strategy supplied. It will then start again on the list of evaluated values, continuing until it gets to only one.

- treeFold :: Strategy a -> Int -> (a -> a -> a) -> a -> [a] -> a
- treeFoldNonEmpty :: Strategy a -> Int -> (a -> a -> a) -> NonEmpty a -> a
- treeFoldMap :: Strategy a -> Int -> (b -> a) -> (a -> a -> a) -> a -> [b] -> a
- treeFoldMapNonEmpty :: Strategy a -> Int -> (b -> a) -> (a -> a -> a) -> NonEmpty b -> a
- rpar :: Strategy a

# Documentation

treeFold :: Strategy a -> Int -> (a -> a -> a) -> a -> [a] -> a Source #

A parallel version of `treeFold`

.

treeFoldNonEmpty :: Strategy a -> Int -> (a -> a -> a) -> NonEmpty a -> a Source #

A parallel version of `treeFoldNonEmpty`

.

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

A parallel version of `treeFoldMap`

.

treeFoldMapNonEmpty :: Strategy a -> Int -> (b -> a) -> (a -> a -> a) -> NonEmpty b -> a Source #

A parallel version of `treeFoldMapNonEmpty`

.