Portability | portable |
---|---|

Stability | provisional |

Maintainer | Edward Kmett <ekmett@gmail.com> |

Safe Haskell | Safe-Inferred |

- scan :: (Monoid m, Eq m) => (Int -> m) -> [m] -> [m]
- scanBy :: Monoid m => (m -> m -> Bool) -> (Int -> m) -> [m] -> [m]
- scanMap :: (Monoid m, Eq m) => (Int -> m) -> (a -> m) -> [a] -> [m]
- scanMapBy :: Monoid m => (m -> m -> Bool) -> (Int -> m) -> (a -> m) -> [a] -> [m]
- scanr :: Eq b => (Int -> b) -> (a -> b -> b) -> b -> [a] -> [b]
- scanrBy :: (b -> b -> Bool) -> (Int -> b) -> (a -> b -> b) -> b -> [a] -> [b]
- scanl :: Eq b => (Int -> b) -> (b -> a -> b) -> b -> [a] -> [b]
- scanlBy :: (b -> b -> Bool) -> (Int -> b) -> (b -> a -> b) -> b -> [a] -> [b]
- scanr1 :: Eq a => (Int -> a) -> (a -> a -> a) -> [a] -> [a]
- scanr1By :: (a -> a -> Bool) -> (Int -> a) -> (a -> a -> a) -> [a] -> [a]
- scanl1 :: Eq a => (Int -> a) -> (a -> a -> a) -> [a] -> [a]
- scanl1By :: (a -> a -> Bool) -> (Int -> a) -> (a -> a -> a) -> [a] -> [a]

# Speculative scans

scan :: (Monoid m, Eq m) => (Int -> m) -> [m] -> [m]Source

Given a valid estimator `g`

,

converts `scan`

g xs`xs`

into a list of the prefix sums.

`g n`

should supply an estimate of the value of the monoidal summation over the first `n`

elements of the container.

If `g n`

is accurate a reasonable percentage of the time and faster to compute than the prefix sum, then this can
provide increased opportunities for parallelism.

scanMap :: (Monoid m, Eq m) => (Int -> m) -> (a -> m) -> [a] -> [m]Source

Given a valid estimator `g`

,

converts `scanMap`

g f xs`xs`

into a list of the prefix sums.

`g n`

should supply an estimate of the value of the monoidal summation over the first `n`

elements of the container.

If `g n`

is accurate a reasonable percentage of the time and faster to compute than the scan, then this can
provide increased opportunities for parallelism.

scan = scanMap id scanMap = scanMapBy (==)

scanr :: Eq b => (Int -> b) -> (a -> b -> b) -> b -> [a] -> [b]Source

Given a valid estimator `g`

,

yields the same answer as `scanr`

g f z xs

.
`scanr'`

f z xs

`g n`

should supply an estimate of the value returned from scanning over the last `n`

elements of the container.

If `g n`

is accurate a reasonable percentage of the time and faster to compute than the scan, then this can
provide increased opportunities for parallelism.