Data.Foldable.Speculation
 Contents Speculative folds Speculative monadic folds Speculative transactional monadic folds Folding actions Applicative actions Monadic actions Speculative transactional monadic actions Specialized folds Searches
Synopsis
Speculative folds
 fold :: (Foldable f, Monoid m, Eq m) => (Int -> m) -> f m -> m Source

Given a valid estimator g, fold g f xs yields the same answer as fold f xs.

g n should supply an estimate of the value of the monoidal summation 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 fold, then this can provide increased opportunities for parallelism.

 foldBy :: (Foldable f, Monoid m) => (m -> m -> Bool) -> (Int -> m) -> f m -> m Source
fold using specBy
 foldMap :: (Foldable f, Monoid m, Eq m) => (Int -> m) -> (a -> m) -> f a -> m Source

Given a valid estimator g, foldMap g f xs yields the same answer as foldMap f xs.

g n should supply an estimate of the value of the monoidal summation 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 fold, then this can provide increased opportunities for parallelism.

 foldMapBy :: (Foldable f, Monoid m) => (m -> m -> Bool) -> (Int -> m) -> (a -> m) -> f a -> m Source
 foldr :: (Foldable f, Eq b) => (Int -> b) -> (a -> b -> b) -> b -> f a -> b Source

Given a valid estimator g, foldr g f z xs yields the same answer as foldr' f z xs.

g n should supply an estimate of the value returned from folding 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 fold, then this can provide increased opportunities for parallelism.

 foldrBy :: Foldable f => (b -> b -> Bool) -> (Int -> b) -> (a -> b -> b) -> b -> f a -> b Source
 foldl :: (Foldable f, Eq b) => (Int -> b) -> (b -> a -> b) -> b -> f a -> b Source

Given a valid estimator g, foldl g f z xs yields the same answer as foldl' f z xs.

g n should supply an estimate of the value returned from folding 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 fold, then this can provide increased opportunities for parallelism.

 foldlBy :: Foldable f => (b -> b -> Bool) -> (Int -> b) -> (b -> a -> b) -> b -> f a -> b Source
 foldr1 :: (Foldable f, Eq a) => (Int -> a) -> (a -> a -> a) -> f a -> a Source
 foldr1By :: Foldable f => (a -> a -> Bool) -> (Int -> a) -> (a -> a -> a) -> f a -> a Source
 foldl1 :: (Foldable f, Eq a) => (Int -> a) -> (a -> a -> a) -> f a -> a Source
 foldl1By :: Foldable f => (a -> a -> Bool) -> (Int -> a) -> (a -> a -> a) -> f a -> a Source
 foldrM :: (Foldable f, Monad m, Eq (m b)) => (Int -> m b) -> (a -> b -> m b) -> m b -> f a -> m b Source
 foldrByM :: (Foldable f, Monad m) => (m b -> m b -> Bool) -> (Int -> m b) -> (a -> b -> m b) -> m b -> f a -> m b Source
 foldlM :: (Foldable f, Monad m, Eq (m b)) => (Int -> m b) -> (b -> a -> m b) -> m b -> f a -> m b Source
 foldlByM :: (Foldable f, Monad m) => (m b -> m b -> Bool) -> (Int -> m b) -> (b -> a -> m b) -> m b -> f a -> m b Source
Speculative transactional monadic folds
 foldrSTM :: (Foldable f, Eq b) => (Int -> STM b) -> (a -> b -> STM b) -> STM b -> f a -> STM b Source
 foldrBySTM :: Foldable f => (b -> b -> STM Bool) -> (Int -> STM b) -> (a -> b -> STM b) -> STM b -> f a -> STM b Source
 foldlSTM :: (Foldable f, Eq a) => (Int -> STM a) -> (a -> b -> STM a) -> STM a -> f b -> STM a Source
 foldlBySTM :: Foldable f => (a -> a -> STM Bool) -> (Int -> STM a) -> (a -> b -> STM a) -> STM a -> f b -> STM a Source
Folding actions
Applicative actions
 traverse_ :: (Foldable t, Applicative f, Eq (f ())) => (Int -> f c) -> (a -> f b) -> t a -> f () Source
Map each element of a structure to an action, evaluate these actions from left to right and ignore the results.
 traverseBy_ :: (Foldable t, Applicative f) => (f () -> f () -> Bool) -> (Int -> f c) -> (a -> f b) -> t a -> f () Source
 for_ :: (Foldable t, Applicative f, Eq (f ())) => (Int -> f c) -> t a -> (a -> f b) -> f () Source
for_ is traverse_ with its arguments flipped.
 forBy_ :: (Foldable t, Applicative f) => (f () -> f () -> Bool) -> (Int -> f c) -> t a -> (a -> f b) -> f () Source
 sequenceA_ :: (Foldable t, Applicative f, Eq (f ())) => (Int -> f b) -> t (f a) -> f () Source
 sequenceByA_ :: (Foldable t, Applicative f, Eq (f ())) => (f () -> f () -> Bool) -> (Int -> f b) -> t (f a) -> f () Source
 asum :: (Foldable t, Alternative f, Eq (f a)) => (Int -> f a) -> t (f a) -> f a Source
 asumBy :: (Foldable t, Alternative f) => (f a -> f a -> Bool) -> (Int -> f a) -> t (f a) -> f a Source
 mapM_ :: (Foldable t, Monad m, Eq (m ())) => (Int -> m c) -> (a -> m b) -> t a -> m () Source
Map each element of the structure to a monadic action, evaluating these actions from left to right and ignoring the results.
 mapByM_ :: (Foldable t, Monad m) => (m () -> m () -> Bool) -> (Int -> m c) -> (a -> m b) -> t a -> m () Source
 forM_ :: (Foldable t, Monad m, Eq (m ())) => (Int -> m c) -> t a -> (a -> m b) -> m () Source
for_ is mapM_ with its arguments flipped.
 forByM_ :: (Foldable t, Monad m) => (m () -> m () -> Bool) -> (Int -> m c) -> t a -> (a -> m b) -> m () Source
 sequence_ :: (Foldable t, Monad m, Eq (m ())) => (Int -> m b) -> t (m a) -> m () Source
 sequenceBy_ :: (Foldable t, Monad m) => (m () -> m () -> Bool) -> (Int -> m b) -> t (m a) -> m () Source
 msum :: (Foldable t, MonadPlus m, Eq (m a)) => (Int -> m a) -> t (m a) -> m a Source
 msumBy :: (Foldable t, MonadPlus m) => (m a -> m a -> Bool) -> (Int -> m a) -> t (m a) -> m a Source
Speculative transactional monadic actions
 mapSTM_ :: Foldable t => STM Bool -> (Int -> STM c) -> (a -> STM b) -> t a -> STM () Source
Map each element of the structure to a monadic action, evaluating these actions from left to right and ignoring the results, while transactional side-effects from mis-speculated actions are rolled back.
 forSTM_ :: Foldable t => STM Bool -> (Int -> STM c) -> t a -> (a -> STM b) -> STM () Source
for_ is mapM_ with its arguments flipped.
 sequenceSTM_ :: Foldable t => STM Bool -> (Int -> STM a) -> t (STM b) -> STM () Source
Specialized folds
 toList :: (Foldable t, Eq a) => (Int -> [a]) -> t a -> [a] Source
 toListBy :: Foldable t => ([a] -> [a] -> Bool) -> (Int -> [a]) -> t a -> [a] Source
 concat :: (Foldable t, Eq a) => (Int -> [a]) -> t [a] -> [a] Source
 concatBy :: Foldable t => ([a] -> [a] -> Bool) -> (Int -> [a]) -> t [a] -> [a] Source
 concatMap :: (Foldable t, Eq b) => (Int -> [b]) -> (a -> [b]) -> t a -> [b] Source
 concatMapBy :: Foldable t => ([b] -> [b] -> Bool) -> (Int -> [b]) -> (a -> [b]) -> t a -> [b] Source
 all :: Foldable t => (Int -> Bool) -> (a -> Bool) -> t a -> Bool Source
 any :: Foldable t => (Int -> Bool) -> (a -> Bool) -> t a -> Bool Source
 and :: Foldable t => (Int -> Bool) -> t Bool -> Bool Source
 or :: Foldable t => (Int -> Bool) -> t Bool -> Bool Source
 sum :: (Foldable t, Num a) => (Int -> a) -> t a -> a Source
 sumBy :: (Foldable t, Num a) => (a -> a -> Bool) -> (Int -> a) -> t a -> a Source
 product :: (Foldable t, Num a) => (Int -> a) -> t a -> a Source
 productBy :: (Foldable t, Num a) => (a -> a -> Bool) -> (Int -> a) -> t a -> a Source
 maximum :: (Foldable t, Ord a) => (Int -> a) -> t a -> a Source
 maximumBy :: Foldable t => (a -> a -> Ordering) -> (Int -> a) -> t a -> a Source
 minimum :: (Foldable t, Ord a) => (Int -> a) -> t a -> a Source
 minimumBy :: Foldable t => (a -> a -> Ordering) -> (Int -> a) -> t a -> a Source
Searches
 elem :: (Foldable t, Eq a) => (Int -> Bool) -> a -> t a -> Bool Source
 elemBy :: Foldable t => (a -> a -> Bool) -> (Int -> Bool) -> a -> t a -> Bool Source
 notElem :: (Foldable t, Eq a) => (Int -> Bool) -> a -> t a -> Bool Source
 notElemBy :: Foldable t => (a -> a -> Bool) -> (Int -> Bool) -> a -> t a -> Bool Source
 find :: (Foldable t, Eq a) => (Int -> Maybe a) -> (a -> Bool) -> t a -> Maybe a Source
 findBy :: Foldable t => (Maybe a -> Maybe a -> Bool) -> (Int -> Maybe a) -> (a -> Bool) -> t a -> Maybe a Source
Produced by Haddock version 2.6.1