vector-0.12.0.3: Efficient Arrays

Copyright | (c) Roman Leshchinskiy 2008-2010
License | BSD-style
Maintainer | Roman Leshchinskiy <rl@cse.unsw.edu.au>
Stability | experimental
Portability | non-portable
Safe Haskell | None
Language | Haskell2010

Data.Vector.Fusion.Bundle.Monadic

Contents

- Size hints
- Length
- Construction
- Accessing elements
- Substreams
- Mapping
- Zipping
- Comparisons
- Filtering
- Searching
- Folding
- Specialised folds
- Unfolding
- Scans
- Enumerations
- Conversions

Description

Monadic bundles.

Synopsis

- data Bundle m v a = Bundle {
  - sElems :: Stream m a
  - sChunks :: Stream m (Chunk v a)
  - sVector :: Maybe (v a)
  - sSize :: Size
  }
- data Chunk v a = Chunk Int (forall m. (PrimMonad m, Vector v a) => Mutable v (PrimState m) a -> m ())
- size :: Bundle m v a -> Size
- sized :: Bundle m v a -> Size -> Bundle m v a
- length :: Monad m => Bundle m v a -> m Int
- null :: Monad m => Bundle m v a -> m Bool
- empty :: Monad m => Bundle m v a
- singleton :: Monad m => a -> Bundle m v a
- cons :: Monad m => a -> Bundle m v a -> Bundle m v a
- snoc :: Monad m => Bundle m v a -> a -> Bundle m v a
- replicate :: Monad m => Int -> a -> Bundle m v a
- replicateM :: Monad m => Int -> m a -> Bundle m v a
- generate :: Monad m => Int -> (Int -> a) -> Bundle m v a
- generateM :: Monad m => Int -> (Int -> m a) -> Bundle m v a
- (++) :: Monad m => Bundle m v a -> Bundle m v a -> Bundle m v a
- head :: Monad m => Bundle m v a -> m a
- last :: Monad m => Bundle m v a -> m a
- (!!) :: Monad m => Bundle m v a -> Int -> m a
- (!?) :: Monad m => Bundle m v a -> Int -> m (Maybe a)
- slice :: Monad m => Int -> Int -> Bundle m v a -> Bundle m v a
- init :: Monad m => Bundle m v a -> Bundle m v a
- tail :: Monad m => Bundle m v a -> Bundle m v a
- take :: Monad m => Int -> Bundle m v a -> Bundle m v a
- drop :: Monad m => Int -> Bundle m v a -> Bundle m v a
- map :: Monad m => (a -> b) -> Bundle m v a -> Bundle m v b
- mapM :: Monad m => (a -> m b) -> Bundle m v a -> Bundle m v b
- mapM_ :: Monad m => (a -> m b) -> Bundle m v a -> m ()
- trans :: (Monad m, Monad m') => (forall z. m z -> m' z) -> Bundle m v a -> Bundle m' v a
- unbox :: Monad m => Bundle m v (Box a) -> Bundle m v a
- concatMap :: Monad m => (a -> Bundle m v b) -> Bundle m v a -> Bundle m v b
- flatten :: Monad m => (a -> m s) -> (s -> m (Step s b)) -> Size -> Bundle m v a -> Bundle m v b
- indexed :: Monad m => Bundle m v a -> Bundle m v (Int, a)
- indexedR :: Monad m => Int -> Bundle m v a -> Bundle m v (Int, a)
- zipWithM_ :: Monad m => (a -> b -> m c) -> Bundle m v a -> Bundle m v b -> m ()
- zipWithM :: Monad m => (a -> b -> m c) -> Bundle m v a -> Bundle m v b -> Bundle m v c
- zipWith3M :: Monad m => (a -> b -> c -> m d) -> Bundle m v a -> Bundle m v b -> Bundle m v c -> Bundle m v d
- zipWith4M :: Monad m => (a -> b -> c -> d -> m e) -> Bundle m v a -> Bundle m v b -> Bundle m v c -> Bundle m v d -> Bundle m v e
- zipWith5M :: Monad m => (a -> b -> c -> d -> e -> m f) -> Bundle m v a -> Bundle m v b -> Bundle m v c -> Bundle m v d -> Bundle m v e -> Bundle m v f
- zipWith6M :: Monad m => (a -> b -> c -> d -> e -> f -> m g) -> Bundle m v a -> Bundle m v b -> Bundle m v c -> Bundle m v d -> Bundle m v e -> Bundle m v f -> Bundle m v g
- zipWith :: Monad m => (a -> b -> c) -> Bundle m v a -> Bundle m v b -> Bundle m v c
- zipWith3 :: Monad m => (a -> b -> c -> d) -> Bundle m v a -> Bundle m v b -> Bundle m v c -> Bundle m v d
- zipWith4 :: Monad m => (a -> b -> c -> d -> e) -> Bundle m v a -> Bundle m v b -> Bundle m v c -> Bundle m v d -> Bundle m v e
- zipWith5 :: Monad m => (a -> b -> c -> d -> e -> f) -> Bundle m v a -> Bundle m v b -> Bundle m v c -> Bundle m v d -> Bundle m v e -> Bundle m v f
- zipWith6 :: Monad m => (a -> b -> c -> d -> e -> f -> g) -> Bundle m v a -> Bundle m v b -> Bundle m v c -> Bundle m v d -> Bundle m v e -> Bundle m v f -> Bundle m v g
- zip :: Monad m => Bundle m v a -> Bundle m v b -> Bundle m v (a, b)
- zip3 :: Monad m => Bundle m v a -> Bundle m v b -> Bundle m v c -> Bundle m v (a, b, c)
- zip4 :: Monad m => Bundle m v a -> Bundle m v b -> Bundle m v c -> Bundle m v d -> Bundle m v (a, b, c, d)
- zip5 :: Monad m => Bundle m v a -> Bundle m v b -> Bundle m v c -> Bundle m v d -> Bundle m v e -> Bundle m v (a, b, c, d, e)
- zip6 :: Monad m => Bundle m v a -> Bundle m v b -> Bundle m v c -> Bundle m v d -> Bundle m v e -> Bundle m v f -> Bundle m v (a, b, c, d, e, f)
- eqBy :: Monad m => (a -> b -> Bool) -> Bundle m v a -> Bundle m v b -> m Bool
- cmpBy :: Monad m => (a -> b -> Ordering) -> Bundle m v a -> Bundle m v b -> m Ordering
- filter :: Monad m => (a -> Bool) -> Bundle m v a -> Bundle m v a
- filterM :: Monad m => (a -> m Bool) -> Bundle m v a -> Bundle m v a
- takeWhile :: Monad m => (a -> Bool) -> Bundle m v a -> Bundle m v a
- takeWhileM :: Monad m => (a -> m Bool) -> Bundle m v a -> Bundle m v a
- dropWhile :: Monad m => (a -> Bool) -> Bundle m v a -> Bundle m v a
- dropWhileM :: Monad m => (a -> m Bool) -> Bundle m v a -> Bundle m v a
- elem :: (Monad m, Eq a) => a -> Bundle m v a -> m Bool
- notElem :: (Monad m, Eq a) => a -> Bundle m v a -> m Bool
- find :: Monad m => (a -> Bool) -> Bundle m v a -> m (Maybe a)
- findM :: Monad m => (a -> m Bool) -> Bundle m v a -> m (Maybe a)
- findIndex :: Monad m => (a -> Bool) -> Bundle m v a -> m (Maybe Int)
- findIndexM :: Monad m => (a -> m Bool) -> Bundle m v a -> m (Maybe Int)
- foldl :: Monad m => (a -> b -> a) -> a -> Bundle m v b -> m a
- foldlM :: Monad m => (a -> b -> m a) -> a -> Bundle m v b -> m a
- foldl1 :: Monad m => (a -> a -> a) -> Bundle m v a -> m a
- foldl1M :: Monad m => (a -> a -> m a) -> Bundle m v a -> m a
- foldM :: Monad m => (a -> b -> m a) -> a -> Bundle m v b -> m a
- fold1M :: Monad m => (a -> a -> m a) -> Bundle m v a -> m a
- foldl' :: Monad m => (a -> b -> a) -> a -> Bundle m v b -> m a
- foldlM' :: Monad m => (a -> b -> m a) -> a -> Bundle m v b -> m a
- foldl1' :: Monad m => (a -> a -> a) -> Bundle m v a -> m a
- foldl1M' :: Monad m => (a -> a -> m a) -> Bundle m v a -> m a
- foldM' :: Monad m => (a -> b -> m a) -> a -> Bundle m v b -> m a
- fold1M' :: Monad m => (a -> a -> m a) -> Bundle m v a -> m a
- foldr :: Monad m => (a -> b -> b) -> b -> Bundle m v a -> m b
- foldrM :: Monad m => (a -> b -> m b) -> b -> Bundle m v a -> m b
- foldr1 :: Monad m => (a -> a -> a) -> Bundle m v a -> m a
- foldr1M :: Monad m => (a -> a -> m a) -> Bundle m v a -> m a
- and :: Monad m => Bundle m v Bool -> m Bool
- or :: Monad m => Bundle m v Bool -> m Bool
- concatMapM :: Monad m => (a -> m (Bundle m v b)) -> Bundle m v a -> Bundle m v b
- unfoldr :: Monad m => (s -> Maybe (a, s)) -> s -> Bundle m u a
- unfoldrM :: Monad m => (s -> m (Maybe (a, s))) -> s -> Bundle m u a
- unfoldrN :: Monad m => Int -> (s -> Maybe (a, s)) -> s -> Bundle m u a
- unfoldrNM :: Monad m => Int -> (s -> m (Maybe (a, s))) -> s -> Bundle m u a
- iterateN :: Monad m => Int -> (a -> a) -> a -> Bundle m u a
- iterateNM :: Monad m => Int -> (a -> m a) -> a -> Bundle m u a
- prescanl :: Monad m => (a -> b -> a) -> a -> Bundle m v b -> Bundle m v a
- prescanlM :: Monad m => (a -> b -> m a) -> a -> Bundle m v b -> Bundle m v a
- prescanl' :: Monad m => (a -> b -> a) -> a -> Bundle m v b -> Bundle m v a
- prescanlM' :: Monad m => (a -> b -> m a) -> a -> Bundle m v b -> Bundle m v a
- postscanl :: Monad m => (a -> b -> a) -> a -> Bundle m v b -> Bundle m v a
- postscanlM :: Monad m => (a -> b -> m a) -> a -> Bundle m v b -> Bundle m v a
- postscanl' :: Monad m => (a -> b -> a) -> a -> Bundle m v b -> Bundle m v a
- postscanlM' :: Monad m => (a -> b -> m a) -> a -> Bundle m v b -> Bundle m v a
- scanl :: Monad m => (a -> b -> a) -> a -> Bundle m v b -> Bundle m v a
- scanlM :: Monad m => (a -> b -> m a) -> a -> Bundle m v b -> Bundle m v a
- scanl' :: Monad m => (a -> b -> a) -> a -> Bundle m v b -> Bundle m v a
- scanlM' :: Monad m => (a -> b -> m a) -> a -> Bundle m v b -> Bundle m v a
- scanl1 :: Monad m => (a -> a -> a) -> Bundle m v a -> Bundle m v a
- scanl1M :: Monad m => (a -> a -> m a) -> Bundle m v a -> Bundle m v a
- scanl1' :: Monad m => (a -> a -> a) -> Bundle m v a -> Bundle m v a
- scanl1M' :: Monad m => (a -> a -> m a) -> Bundle m v a -> Bundle m v a
- enumFromStepN :: (Num a, Monad m) => a -> a -> Int -> Bundle m v a
- enumFromTo :: (Enum a, Monad m) => a -> a -> Bundle m v a
- enumFromThenTo :: (Enum a, Monad m) => a -> a -> a -> Bundle m v a
- toList :: Monad m => Bundle m v a -> m [a]
- fromList :: Monad m => [a] -> Bundle m v a
- fromListN :: Monad m => Int -> [a] -> Bundle m v a
- unsafeFromList :: Monad m => Size -> [a] -> Bundle m v a
- fromVector :: (Monad m, Vector v a) => v a -> Bundle m v a
- reVector :: Monad m => Bundle m u a -> Bundle m v a
- fromVectors :: forall m v a. (Monad m, Vector v a) => [v a] -> Bundle m v a
- concatVectors :: (Monad m, Vector v a) => Bundle m u (v a) -> Bundle m v a
- fromStream :: Monad m => Stream m a -> Size -> Bundle m v a
- chunks :: Bundle m v a -> Stream m (Chunk v a)
- elements :: Bundle m v a -> Stream m a

# Documentation

data Bundle m v a #

Monadic streams

Constructors

Bundle |

Fields

- sElems :: Stream m a
- sChunks :: Stream m (Chunk v a)
- sVector :: Maybe (v a)
- sSize :: Size

Instances

Monad m => Functor (Bundle m v) # |
Instance details Defined in Data.Vector.Fusion.Bundle.Monadic Methods fmap :: (a -> b) -> Bundle m v a -> Bundle m v b # (<$) :: a -> Bundle m v b -> Bundle m v a #
Eq1 (Bundle Id v) # |
Instance details Defined in Data.Vector.Fusion.Bundle Methods liftEq :: (a -> b -> Bool) -> Bundle Id v a -> Bundle Id v b -> Bool #
Ord1 (Bundle Id v) # |
Instance details Defined in Data.Vector.Fusion.Bundle Methods liftCompare :: (a -> b -> Ordering) -> Bundle Id v a -> Bundle Id v b -> Ordering #
Eq a => Eq (Bundle Id v a) # |
Instance details Defined in Data.Vector.Fusion.Bundle Methods (==) :: Bundle Id v a -> Bundle Id v a -> Bool # (/=) :: Bundle Id v a -> Bundle Id v a -> Bool #
Ord a => Ord (Bundle Id v a) # |

Instance details

Defined in Data.Vector.Fusion.Bundle

Methods

compare :: Bundle Id v a -> Bundle Id v a -> Ordering #

(<) :: Bundle Id v a -> Bundle Id v a -> Bool #

(<=) :: Bundle Id v a -> Bundle Id v a -> Bool #

(>) :: Bundle Id v a -> Bundle Id v a -> Bool #

(>=) :: Bundle Id v a -> Bundle Id v a -> Bool #

max :: Bundle Id v a -> Bundle Id v a -> Bundle Id v a #

min :: Bundle Id v a -> Bundle Id v a -> Bundle Id v a #

data Chunk v a #

Constructors

Chunk Int (forall m. (PrimMonad m, Vector v a) => Mutable v (PrimState m) a -> m ()) |

# Size hints

size :: Bundle m v a -> Size #

`Size` hint of a `Bundle`

sized :: Bundle m v a -> Size -> Bundle m v a #

Attach a `Size` hint to a `Bundle`

# Length

length :: Monad m => Bundle m v a -> m Int #

Length of a `Bundle`

null :: Monad m => Bundle m v a -> m Bool #

Check if a `Bundle` is empty

# Construction

empty :: Monad m => Bundle m v a #

Empty `Bundle`

singleton :: Monad m => a -> Bundle m v a #

Singleton `Bundle`

cons :: Monad m => a -> Bundle m v a -> Bundle m v a #

Prepend an element

snoc :: Monad m => Bundle m v a -> a -> Bundle m v a #

Append an element

replicate :: Monad m => Int -> a -> Bundle m v a #

Replicate a value to a given length

replicateM :: Monad m => Int -> m a -> Bundle m v a #

Yield a `Bundle` of values obtained by performing the monadic action the given number of times

generate :: Monad m => Int -> (Int -> a) -> Bundle m v a #

generateM :: Monad m => Int -> (Int -> m a) -> Bundle m v a #

Generate a stream from its indices

(++) :: Monad m => Bundle m v a -> Bundle m v a -> Bundle m v a infixr 5 #

Concatenate two `Bundle`s

# Accessing elements

head :: Monad m => Bundle m v a -> m a #

First element of the `Bundle` or error if empty

last :: Monad m => Bundle m v a -> m a #

Last element of the `Bundle` or error if empty

(!!) :: Monad m => Bundle m v a -> Int -> m a infixl 9 #

Element at the given position

(!?) :: Monad m => Bundle m v a -> Int -> m (Maybe a) infixl 9 #

Element at the given position or `Nothing` if out of bounds

# Substreams

slice #

Arguments

:: Monad m |
=> Int | starting index
-> Int | length
-> Bundle m v a |
-> Bundle m v a |

Extract a substream of the given length starting at the given position.

init :: Monad m => Bundle m v a -> Bundle m v a #

All but the last element

tail :: Monad m => Bundle m v a -> Bundle m v a #

All but the first element

take :: Monad m => Int -> Bundle m v a -> Bundle m v a #

The first `n` elements

drop :: Monad m => Int -> Bundle m v a -> Bundle m v a #

All but the first `n` elements

# Mapping

map :: Monad m => (a -> b) -> Bundle m v a -> Bundle m v b #

Map a function over a `Bundle`

mapM :: Monad m => (a -> m b) -> Bundle m v a -> Bundle m v b #

Map a monadic function over a `Bundle`

mapM_ :: Monad m => (a -> m b) -> Bundle m v a -> m () #

Execute a monadic action for each element of the `Bundle`

trans :: (Monad m, Monad m') => (forall z. m z -> m' z) -> Bundle m v a -> Bundle m' v a #

Transform a `Bundle` to use a different monad

unbox :: Monad m => Bundle m v (Box a) -> Bundle m v a #

concatMap :: Monad m => (a -> Bundle m v b) -> Bundle m v a -> Bundle m v b #

flatten :: Monad m => (a -> m s) -> (s -> m (Step s b)) -> Size -> Bundle m v a -> Bundle m v b #

Create a `Bundle` of values from a `Bundle` of streamable things

# Zipping

indexed :: Monad m => Bundle m v a -> Bundle m v (Int, a) #

Pair each element in a `Bundle` with its index

indexedR :: Monad m => Int -> Bundle m v a -> Bundle m v (Int, a) #

Pair each element in a `Bundle` with its index, starting from the right and counting down

zipWithM_ :: Monad m => (a -> b -> m c) -> Bundle m v a -> Bundle m v b -> m () #

zipWithM :: Monad m => (a -> b -> m c) -> Bundle m v a -> Bundle m v b -> Bundle m v c #

Zip two `Bundle`s with the given monadic function

zipWith3M :: Monad m => (a -> b -> c -> m d) -> Bundle m v a -> Bundle m v b -> Bundle m v c -> Bundle m v d #

zipWith4M :: Monad m => (a -> b -> c -> d -> m e) -> Bundle m v a -> Bundle m v b -> Bundle m v c -> Bundle m v d -> Bundle m v e #

zipWith5M :: Monad m => (a -> b -> c -> d -> e -> m f) -> Bundle m v a -> Bundle m v b -> Bundle m v c -> Bundle m v d -> Bundle m v e -> Bundle m v f #

zipWith6M :: Monad m => (a -> b -> c -> d -> e -> f -> m g) -> Bundle m v a -> Bundle m v b -> Bundle m v c -> Bundle m v d -> Bundle m v e -> Bundle m v f -> Bundle m v g #

zipWith :: Monad m => (a -> b -> c) -> Bundle m v a -> Bundle m v b -> Bundle m v c #

zipWith3 :: Monad m => (a -> b -> c -> d) -> Bundle m v a -> Bundle m v b -> Bundle m v c -> Bundle m v d #

zipWith4 :: Monad m => (a -> b -> c -> d -> e) -> Bundle m v a -> Bundle m v b -> Bundle m v c -> Bundle m v d -> Bundle m v e #

zipWith5 :: Monad m => (a -> b -> c -> d -> e -> f) -> Bundle m v a -> Bundle m v b -> Bundle m v c -> Bundle m v d -> Bundle m v e -> Bundle m v f #

zipWith6 :: Monad m => (a -> b -> c -> d -> e -> f -> g) -> Bundle m v a -> Bundle m v b -> Bundle m v c -> Bundle m v d -> Bundle m v e -> Bundle m v f -> Bundle m v g #

zip :: Monad m => Bundle m v a -> Bundle m v b -> Bundle m v (a, b) #

zip3 :: Monad m => Bundle m v a -> Bundle m v b -> Bundle m v c -> Bundle m v (a, b, c) #

zip4 :: Monad m => Bundle m v a -> Bundle m v b -> Bundle m v c -> Bundle m v d -> Bundle m v (a, b, c, d) #

zip5 :: Monad m => Bundle m v a -> Bundle m v b -> Bundle m v c -> Bundle m v d -> Bundle m v e -> Bundle m v (a, b, c, d, e) #

zip6 :: Monad m => Bundle m v a -> Bundle m v b -> Bundle m v c -> Bundle m v d -> Bundle m v e -> Bundle m v f -> Bundle m v (a, b, c, d, e, f) #

# Comparisons

eqBy :: Monad m => (a -> b -> Bool) -> Bundle m v a -> Bundle m v b -> m Bool #

Check if two `Bundle`s are equal

cmpBy :: Monad m => (a -> b -> Ordering) -> Bundle m v a -> Bundle m v b -> m Ordering #

Lexicographically compare two `Bundle`s

# Filtering

filter :: Monad m => (a -> Bool) -> Bundle m v a -> Bundle m v a #

Drop elements which do not satisfy the predicate

filterM :: Monad m => (a -> m Bool) -> Bundle m v a -> Bundle m v a #

Drop elements which do not satisfy the monadic predicate

takeWhile :: Monad m => (a -> Bool) -> Bundle m v a -> Bundle m v a #

Longest prefix of elements that satisfy the predicate

takeWhileM :: Monad m => (a -> m Bool) -> Bundle m v a -> Bundle m v a #

Longest prefix of elements that satisfy the monadic predicate

dropWhile :: Monad m => (a -> Bool) -> Bundle m v a -> Bundle m v a #

Drop the longest prefix of elements that satisfy the predicate

dropWhileM :: Monad m => (a -> m Bool) -> Bundle m v a -> Bundle m v a #

Drop the longest prefix of elements that satisfy the monadic predicate

# Searching

elem :: (Monad m, Eq a) => a -> Bundle m v a -> m Bool infix 4 #

Check whether the `Bundle` contains an element

notElem :: (Monad m, Eq a) => a -> Bundle m v a -> m Bool infix 4 #

Inverse of `elem`

find :: Monad m => (a -> Bool) -> Bundle m v a -> m (Maybe a) #

Yield `Just` the first element that satisfies the predicate or `Nothing` if no such element exists.

findM :: Monad m => (a -> m Bool) -> Bundle m v a -> m (Maybe a) #

Yield `Just` the first element that satisfies the monadic predicate or `Nothing` if no such element exists.

findIndex :: Monad m => (a -> Bool) -> Bundle m v a -> m (Maybe Int) #

Yield `Just` the index of the first element that satisfies the predicate or `Nothing` if no such element exists.

findIndexM :: Monad m => (a -> m Bool) -> Bundle m v a -> m (Maybe Int) #

Yield `Just` the index of the first element that satisfies the monadic predicate or `Nothing` if no such element exists.

# Folding

foldl :: Monad m => (a -> b -> a) -> a -> Bundle m v b -> m a #

Left fold

foldlM :: Monad m => (a -> b -> m a) -> a -> Bundle m v b -> m a #

Left fold with a monadic operator

foldl1 :: Monad m => (a -> a -> a) -> Bundle m v a -> m a #

Left fold over a non-empty `Bundle`

foldl1M :: Monad m => (a -> a -> m a) -> Bundle m v a -> m a #

Left fold over a non-empty `Bundle` with a monadic operator

foldM :: Monad m => (a -> b -> m a) -> a -> Bundle m v b -> m a #

Same as `foldlM`

fold1M :: Monad m => (a -> a -> m a) -> Bundle m v a -> m a #

Same as `foldl1M`

foldl' :: Monad m => (a -> b -> a) -> a -> Bundle m v b -> m a #

Left fold with a strict accumulator

foldlM' :: Monad m => (a -> b -> m a) -> a -> Bundle m v b -> m a #

Left fold with a strict accumulator and a monadic operator

foldl1' :: Monad m => (a -> a -> a) -> Bundle m v a -> m a #

Left fold over a non-empty `Bundle` with a strict accumulator

foldl1M' :: Monad m => (a -> a -> m a) -> Bundle m v a -> m a #

Left fold over a non-empty `Bundle` with a strict accumulator and a monadic operator

foldM' :: Monad m => (a -> b -> m a) -> a -> Bundle m v b -> m a #

Same as `foldlM'`

fold1M' :: Monad m => (a -> a -> m a) -> Bundle m v a -> m a #

Same as `foldl1M'`

foldr :: Monad m => (a -> b -> b) -> b -> Bundle m v a -> m b #

Right fold

foldrM :: Monad m => (a -> b -> m b) -> b -> Bundle m v a -> m b #

Right fold with a monadic operator

foldr1 :: Monad m => (a -> a -> a) -> Bundle m v a -> m a #

Right fold over a non-empty stream

foldr1M :: Monad m => (a -> a -> m a) -> Bundle m v a -> m a #

Right fold over a non-empty stream with a monadic operator

# Specialised folds

and :: Monad m => Bundle m v Bool -> m Bool #

or :: Monad m => Bundle m v Bool -> m Bool #

concatMapM :: Monad m => (a -> m (Bundle m v b)) -> Bundle m v a -> Bundle m v b #

# Unfolding

unfoldr :: Monad m => (s -> Maybe (a, s)) -> s -> Bundle m u a #

Unfold

unfoldrM :: Monad m => (s -> m (Maybe (a, s))) -> s -> Bundle m u a #

Unfold with a monadic function

unfoldrN :: Monad m => Int -> (s -> Maybe (a, s)) -> s -> Bundle m u a #

Unfold at most `n` elements

unfoldrNM :: Monad m => Int -> (s -> m (Maybe (a, s))) -> s -> Bundle m u a #

Unfold at most `n` elements with a monadic functions

iterateN :: Monad m => Int -> (a -> a) -> a -> Bundle m u a #

Apply function n times to value. Zeroth element is original value.

iterateNM :: Monad m => Int -> (a -> m a) -> a -> Bundle m u a #

Apply monadic function n times to value. Zeroth element is original value.

# Scans

prescanl :: Monad m => (a -> b -> a) -> a -> Bundle m v b -> Bundle m v a #

Prefix scan

prescanlM :: Monad m => (a -> b -> m a) -> a -> Bundle m v b -> Bundle m v a #

Prefix scan with a monadic operator

prescanl' :: Monad m => (a -> b -> a) -> a -> Bundle m v b -> Bundle m v a #

Prefix scan with strict accumulator

prescanlM' :: Monad m => (a -> b -> m a) -> a -> Bundle m v b -> Bundle m v a #

Prefix scan with strict accumulator and a monadic operator

postscanl :: Monad m => (a -> b -> a) -> a -> Bundle m v b -> Bundle m v a #

Suffix scan

postscanlM :: Monad m => (a -> b -> m a) -> a -> Bundle m v b -> Bundle m v a #

Suffix scan with a monadic operator

postscanl' :: Monad m => (a -> b -> a) -> a -> Bundle m v b -> Bundle m v a #

Suffix scan with strict accumulator

postscanlM' :: Monad m => (a -> b -> m a) -> a -> Bundle m v b -> Bundle m v a #

Suffix scan with strict acccumulator and a monadic operator

scanl :: Monad m => (a -> b -> a) -> a -> Bundle m v b -> Bundle m v a #

Haskell-style scan

scanlM :: Monad m => (a -> b -> m a) -> a -> Bundle m v b -> Bundle m v a #

Haskell-style scan with a monadic operator

scanl' :: Monad m => (a -> b -> a) -> a -> Bundle m v b -> Bundle m v a #

Haskell-style scan with strict accumulator

scanlM' :: Monad m => (a -> b -> m a) -> a -> Bundle m v b -> Bundle m v a #

Haskell-style scan with strict accumulator and a monadic operator

scanl1 :: Monad m => (a -> a -> a) -> Bundle m v a -> Bundle m v a #

Scan over a non-empty `Bundle`

scanl1M :: Monad m => (a -> a -> m a) -> Bundle m v a -> Bundle m v a #

Scan over a non-empty `Bundle` with a monadic operator

scanl1' :: Monad m => (a -> a -> a) -> Bundle m v a -> Bundle m v a #

Scan over a non-empty `Bundle` with a strict accumulator

scanl1M' :: Monad m => (a -> a -> m a) -> Bundle m v a -> Bundle m v a #

Scan over a non-empty `Bundle` with a strict accumulator and a monadic operator

# Enumerations

enumFromStepN :: (Num a, Monad m) => a -> a -> Int -> Bundle m v a #

Yield a `Bundle` of the given length containing the values `x`, `x+y`, `x+y+y` etc.

enumFromTo :: (Enum a, Monad m) => a -> a -> Bundle m v a #

Enumerate values

WARNING: This operation can be very inefficient. If at all possible, use `enumFromStepN` instead.

enumFromThenTo :: (Enum a, Monad m) => a -> a -> a -> Bundle m v a #

Enumerate values with a given step.

WARNING: This operation is very inefficient. If at all possible, use `enumFromStepN` instead.

# Conversions

toList :: Monad m => Bundle m v a -> m [a] #

Convert a `Bundle` to a list

fromList :: Monad m => [a] -> Bundle m v a #

Convert a list to a `Bundle`

fromListN :: Monad m => Int -> [a] -> Bundle m v a #

Convert the first `n` elements of a list to a `Bundle`

unsafeFromList :: Monad m => Size -> [a] -> Bundle m v a #

Convert a list to a `Bundle` with the given `Size` hint.

fromVector :: (Monad m, Vector v a) => v a -> Bundle m v a #

reVector :: Monad m => Bundle m u a -> Bundle m v a #

fromVectors :: forall m v a. (Monad m, Vector v a) => [v a] -> Bundle m v a #

concatVectors :: (Monad m, Vector v a) => Bundle m u (v a) -> Bundle m v a #

fromStream :: Monad m => Stream m a -> Size -> Bundle m v a #

chunks :: Bundle m v a -> Stream m (Chunk v a) #

elements :: Bundle m v a -> Stream m a #