vector-0.13.2.0: Efficient Arrays

Copyright | (c) Roman Leshchinskiy 2008-2010 Alexey Kuleshevich 2020-2022 Aleksey Khudyakov 2020-2022 Andrew Lelechenko 2020-2022
License | BSD-style
Maintainer | Haskell Libraries Team <libraries@haskell.org>
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 :: Type -> Type) (v :: Type -> Type) a = Bundle {
  - sElems :: Stream m a
  - sChunks :: Stream m (Chunk v a)
  - sVector :: Maybe (v a)
  - sSize :: Size
  }
- data Chunk (v :: Type -> Type) a = Chunk Int (forall (m :: Type -> Type). (PrimMonad m, Vector v a) => Mutable v (PrimState m) a -> m ())
- lift :: forall (m :: Type -> Type) (v :: Type -> Type) a. Monad m => Bundle Id v a -> Bundle m v a
- size :: forall (m :: Type -> Type) (v :: Type -> Type) a. Bundle m v a -> Size
- sized :: forall (m :: Type -> Type) (v :: Type -> Type) a. Bundle m v a -> Size -> Bundle m v a
- length :: forall m (v :: Type -> Type) a. Monad m => Bundle m v a -> m Int
- null :: forall m (v :: Type -> Type) a. Monad m => Bundle m v a -> m Bool
- empty :: forall (m :: Type -> Type) (v :: Type -> Type) a. Monad m => Bundle m v a
- singleton :: forall (m :: Type -> Type) a (v :: Type -> Type). Monad m => a -> Bundle m v a
- cons :: forall (m :: Type -> Type) a (v :: Type -> Type). Monad m => a -> Bundle m v a -> Bundle m v a
- snoc :: forall (m :: Type -> Type) (v :: Type -> Type) a. Monad m => Bundle m v a -> a -> Bundle m v a
- replicate :: forall (m :: Type -> Type) a (v :: Type -> Type). Monad m => Int -> a -> Bundle m v a
- replicateM :: forall m a (v :: Type -> Type). Monad m => Int -> m a -> Bundle m v a
- generate :: forall (m :: Type -> Type) a (v :: Type -> Type). Monad m => Int -> (Int -> a) -> Bundle m v a
- generateM :: forall m a (v :: Type -> Type). Monad m => Int -> (Int -> m a) -> Bundle m v a
- (++) :: forall (m :: Type -> Type) (v :: Type -> Type) a. Monad m => Bundle m v a -> Bundle m v a -> Bundle m v a
- head :: forall m (v :: Type -> Type) a. Monad m => Bundle m v a -> m a
- last :: forall m (v :: Type -> Type) a. Monad m => Bundle m v a -> m a
- (!!) :: forall m (v :: Type -> Type) a. Monad m => Bundle m v a -> Int -> m a
- (!?) :: forall m (v :: Type -> Type) a. Monad m => Bundle m v a -> Int -> m (Maybe a)
- slice :: forall (m :: Type -> Type) (v :: Type -> Type) a. Monad m => Int -> Int -> Bundle m v a -> Bundle m v a
- init :: forall (m :: Type -> Type) (v :: Type -> Type) a. Monad m => Bundle m v a -> Bundle m v a
- tail :: forall (m :: Type -> Type) (v :: Type -> Type) a. Monad m => Bundle m v a -> Bundle m v a
- take :: forall (m :: Type -> Type) (v :: Type -> Type) a. Monad m => Int -> Bundle m v a -> Bundle m v a
- drop :: forall (m :: Type -> Type) (v :: Type -> Type) a. Monad m => Int -> Bundle m v a -> Bundle m v a
- map :: forall (m :: Type -> Type) a b (v :: Type -> Type). Monad m => (a -> b) -> Bundle m v a -> Bundle m v b
- mapM :: forall m a b (v :: Type -> Type). Monad m => (a -> m b) -> Bundle m v a -> Bundle m v b
- mapM_ :: forall m a b (v :: Type -> Type). Monad m => (a -> m b) -> Bundle m v a -> m ()
- trans :: forall m m' (v :: Type -> Type) a. (Monad m, Monad m') => (forall z. m z -> m' z) -> Bundle m v a -> Bundle m' v a
- unbox :: forall (m :: Type -> Type) (v :: Type -> Type) a. Monad m => Bundle m v (Box a) -> Bundle m v a
- concatMap :: forall (m :: Type -> Type) a (v :: Type -> Type) b. Monad m => (a -> Bundle m v b) -> Bundle m v a -> Bundle m v b
- flatten :: forall m a s b (v :: Type -> Type). Monad m => (a -> m s) -> (s -> m (Step s b)) -> Size -> Bundle m v a -> Bundle m v b
- indexed :: forall (m :: Type -> Type) (v :: Type -> Type) a. Monad m => Bundle m v a -> Bundle m v (Int, a)
- indexedR :: forall (m :: Type -> Type) (v :: Type -> Type) a. Monad m => Int -> Bundle m v a -> Bundle m v (Int, a)
- zipWithM_ :: forall m a b c (v :: Type -> Type). Monad m => (a -> b -> m c) -> Bundle m v a -> Bundle m v b -> m ()
- zipWithM :: forall m a b c (v :: Type -> Type). Monad m => (a -> b -> m c) -> Bundle m v a -> Bundle m v b -> Bundle m v c
- zipWith3M :: forall m a b c d (v :: Type -> Type). Monad m => (a -> b -> c -> m d) -> Bundle m v a -> Bundle m v b -> Bundle m v c -> Bundle m v d
- zipWith4M :: forall m a b c d e (v :: Type -> Type). 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 :: forall m a b c d e f (v :: Type -> Type). 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 :: forall m a b c d e f g (v :: Type -> Type). 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 :: forall (m :: Type -> Type) a b c (v :: Type -> Type). Monad m => (a -> b -> c) -> Bundle m v a -> Bundle m v b -> Bundle m v c
- zipWith3 :: forall (m :: Type -> Type) a b c d (v :: Type -> Type). Monad m => (a -> b -> c -> d) -> Bundle m v a -> Bundle m v b -> Bundle m v c -> Bundle m v d
- zipWith4 :: forall (m :: Type -> Type) a b c d e (v :: Type -> Type). 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 :: forall (m :: Type -> Type) a b c d e f (v :: Type -> Type). 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 :: forall (m :: Type -> Type) a b c d e f g (v :: Type -> Type). 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 :: forall (m :: Type -> Type) (v :: Type -> Type) a b. Monad m => Bundle m v a -> Bundle m v b -> Bundle m v (a, b)
- zip3 :: forall (m :: Type -> Type) (v :: Type -> Type) a b c. Monad m => Bundle m v a -> Bundle m v b -> Bundle m v c -> Bundle m v (a, b, c)
- zip4 :: forall (m :: Type -> Type) (v :: Type -> Type) a b c d. 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 :: forall (m :: Type -> Type) (v :: Type -> Type) a b c d e. 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 :: forall (m :: Type -> Type) (v :: Type -> Type) a b c d e f. 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 :: forall m a b (v :: Type -> Type). Monad m => (a -> b -> Bool) -> Bundle m v a -> Bundle m v b -> m Bool
- cmpBy :: forall m a b (v :: Type -> Type). Monad m => (a -> b -> Ordering) -> Bundle m v a -> Bundle m v b -> m Ordering
- filter :: forall (m :: Type -> Type) a (v :: Type -> Type). Monad m => (a -> Bool) -> Bundle m v a -> Bundle m v a
- filterM :: forall m a (v :: Type -> Type). Monad m => (a -> m Bool) -> Bundle m v a -> Bundle m v a
- mapMaybeM :: forall m a b (v :: Type -> Type). Monad m => (a -> m (Maybe b)) -> Bundle m v a -> Bundle m v b
- takeWhile :: forall (m :: Type -> Type) a (v :: Type -> Type). Monad m => (a -> Bool) -> Bundle m v a -> Bundle m v a
- takeWhileM :: forall m a (v :: Type -> Type). Monad m => (a -> m Bool) -> Bundle m v a -> Bundle m v a
- dropWhile :: forall (m :: Type -> Type) a (v :: Type -> Type). Monad m => (a -> Bool) -> Bundle m v a -> Bundle m v a
- dropWhileM :: forall m a (v :: Type -> Type). Monad m => (a -> m Bool) -> Bundle m v a -> Bundle m v a
- elem :: forall m a (v :: Type -> Type). (Monad m, Eq a) => a -> Bundle m v a -> m Bool
- notElem :: forall m a (v :: Type -> Type). (Monad m, Eq a) => a -> Bundle m v a -> m Bool
- find :: forall m a (v :: Type -> Type). Monad m => (a -> Bool) -> Bundle m v a -> m (Maybe a)
- findM :: forall m a (v :: Type -> Type). Monad m => (a -> m Bool) -> Bundle m v a -> m (Maybe a)
- findIndex :: forall m a (v :: Type -> Type). Monad m => (a -> Bool) -> Bundle m v a -> m (Maybe Int)
- findIndexM :: forall m a (v :: Type -> Type). Monad m => (a -> m Bool) -> Bundle m v a -> m (Maybe Int)
- foldl :: forall m a b (v :: Type -> Type). Monad m => (a -> b -> a) -> a -> Bundle m v b -> m a
- foldlM :: forall m a b (v :: Type -> Type). Monad m => (a -> b -> m a) -> a -> Bundle m v b -> m a
- foldl1 :: forall m a (v :: Type -> Type). Monad m => (a -> a -> a) -> Bundle m v a -> m a
- foldl1M :: forall m a (v :: Type -> Type). Monad m => (a -> a -> m a) -> Bundle m v a -> m a
- foldM :: forall m a b (v :: Type -> Type). Monad m => (a -> b -> m a) -> a -> Bundle m v b -> m a
- fold1M :: forall m a (v :: Type -> Type). Monad m => (a -> a -> m a) -> Bundle m v a -> m a
- foldl' :: forall m a b (v :: Type -> Type). Monad m => (a -> b -> a) -> a -> Bundle m v b -> m a
- foldlM' :: forall m a b (v :: Type -> Type). Monad m => (a -> b -> m a) -> a -> Bundle m v b -> m a
- foldl1' :: forall m a (v :: Type -> Type). Monad m => (a -> a -> a) -> Bundle m v a -> m a
- foldl1M' :: forall m a (v :: Type -> Type). Monad m => (a -> a -> m a) -> Bundle m v a -> m a
- foldM' :: forall m a b (v :: Type -> Type). Monad m => (a -> b -> m a) -> a -> Bundle m v b -> m a
- fold1M' :: forall m a (v :: Type -> Type). Monad m => (a -> a -> m a) -> Bundle m v a -> m a
- foldr :: forall m a b (v :: Type -> Type). Monad m => (a -> b -> b) -> b -> Bundle m v a -> m b
- foldrM :: forall m a b (v :: Type -> Type). Monad m => (a -> b -> m b) -> b -> Bundle m v a -> m b
- foldr1 :: forall m a (v :: Type -> Type). Monad m => (a -> a -> a) -> Bundle m v a -> m a
- foldr1M :: forall m a (v :: Type -> Type). Monad m => (a -> a -> m a) -> Bundle m v a -> m a
- and :: forall m (v :: Type -> Type). Monad m => Bundle m v Bool -> m Bool
- or :: forall m (v :: Type -> Type). Monad m => Bundle m v Bool -> m Bool
- concatMapM :: forall m a (v :: Type -> Type) b. Monad m => (a -> m (Bundle m v b)) -> Bundle m v a -> Bundle m v b
- unfoldr :: forall (m :: Type -> Type) s a (u :: Type -> Type). Monad m => (s -> Maybe (a, s)) -> s -> Bundle m u a
- unfoldrM :: forall m s a (u :: Type -> Type). Monad m => (s -> m (Maybe (a, s))) -> s -> Bundle m u a
- unfoldrN :: forall (m :: Type -> Type) s a (u :: Type -> Type). Monad m => Int -> (s -> Maybe (a, s)) -> s -> Bundle m u a
- unfoldrNM :: forall m s a (u :: Type -> Type). Monad m => Int -> (s -> m (Maybe (a, s))) -> s -> Bundle m u a
- unfoldrExactN :: forall (m :: Type -> Type) s a (u :: Type -> Type). Monad m => Int -> (s -> (a, s)) -> s -> Bundle m u a
- unfoldrExactNM :: forall m s a (u :: Type -> Type). Monad m => Int -> (s -> m (a, s)) -> s -> Bundle m u a
- iterateN :: forall (m :: Type -> Type) a (u :: Type -> Type). Monad m => Int -> (a -> a) -> a -> Bundle m u a
- iterateNM :: forall m a (u :: Type -> Type). Monad m => Int -> (a -> m a) -> a -> Bundle m u a
- prescanl :: forall (m :: Type -> Type) a b (v :: Type -> Type). Monad m => (a -> b -> a) -> a -> Bundle m v b -> Bundle m v a
- prescanlM :: forall m a b (v :: Type -> Type). Monad m => (a -> b -> m a) -> a -> Bundle m v b -> Bundle m v a
- prescanl' :: forall (m :: Type -> Type) a b (v :: Type -> Type). Monad m => (a -> b -> a) -> a -> Bundle m v b -> Bundle m v a
- prescanlM' :: forall m a b (v :: Type -> Type). Monad m => (a -> b -> m a) -> a -> Bundle m v b -> Bundle m v a
- postscanl :: forall (m :: Type -> Type) a b (v :: Type -> Type). Monad m => (a -> b -> a) -> a -> Bundle m v b -> Bundle m v a
- postscanlM :: forall m a b (v :: Type -> Type). Monad m => (a -> b -> m a) -> a -> Bundle m v b -> Bundle m v a
- postscanl' :: forall (m :: Type -> Type) a b (v :: Type -> Type). Monad m => (a -> b -> a) -> a -> Bundle m v b -> Bundle m v a
- postscanlM' :: forall m a b (v :: Type -> Type). Monad m => (a -> b -> m a) -> a -> Bundle m v b -> Bundle m v a
- scanl :: forall (m :: Type -> Type) a b (v :: Type -> Type). Monad m => (a -> b -> a) -> a -> Bundle m v b -> Bundle m v a
- scanlM :: forall m a b (v :: Type -> Type). Monad m => (a -> b -> m a) -> a -> Bundle m v b -> Bundle m v a
- scanl' :: forall (m :: Type -> Type) a b (v :: Type -> Type). Monad m => (a -> b -> a) -> a -> Bundle m v b -> Bundle m v a
- scanlM' :: forall m a b (v :: Type -> Type). Monad m => (a -> b -> m a) -> a -> Bundle m v b -> Bundle m v a
- scanl1 :: forall (m :: Type -> Type) a (v :: Type -> Type). Monad m => (a -> a -> a) -> Bundle m v a -> Bundle m v a
- scanl1M :: forall m a (v :: Type -> Type). Monad m => (a -> a -> m a) -> Bundle m v a -> Bundle m v a
- scanl1' :: forall (m :: Type -> Type) a (v :: Type -> Type). Monad m => (a -> a -> a) -> Bundle m v a -> Bundle m v a
- scanl1M' :: forall m a (v :: Type -> Type). Monad m => (a -> a -> m a) -> Bundle m v a -> Bundle m v a
- enumFromStepN :: forall a (m :: Type -> Type) (v :: Type -> Type). (Num a, Monad m) => a -> a -> Int -> Bundle m v a
- enumFromTo :: forall a (m :: Type -> Type) (v :: Type -> Type). (Enum a, Monad m) => a -> a -> Bundle m v a
- enumFromThenTo :: forall a (m :: Type -> Type) (v :: Type -> Type). (Enum a, Monad m) => a -> a -> a -> Bundle m v a
- toList :: forall m (v :: Type -> Type) a. Monad m => Bundle m v a -> m [a]
- fromList :: forall (m :: Type -> Type) a (v :: Type -> Type). Monad m => [a] -> Bundle m v a
- fromListN :: forall (m :: Type -> Type) a (v :: Type -> Type). Monad m => Int -> [a] -> Bundle m v a
- unsafeFromList :: forall (m :: Type -> Type) a (v :: Type -> Type). Monad m => Size -> [a] -> Bundle m v a
- fromVector :: forall (m :: Type -> Type) v a. (Monad m, Vector v a) => v a -> Bundle m v a
- reVector :: forall (m :: Type -> Type) (u :: Type -> Type) a (v :: Type -> Type). Monad m => Bundle m u a -> Bundle m v a
- fromVectors :: forall (m :: Type -> Type) v a. (Monad m, Vector v a) => [v a] -> Bundle m v a
- concatVectors :: forall (m :: Type -> Type) v a (u :: Type -> Type). (Monad m, Vector v a) => Bundle m u (v a) -> Bundle m v a
- fromStream :: forall (m :: Type -> Type) a (v :: Type -> Type). Monad m => Stream m a -> Size -> Bundle m v a
- chunks :: forall (m :: Type -> Type) (v :: Type -> Type) a. Bundle m v a -> Stream m (Chunk v a)
- elements :: forall (m :: Type -> Type) (v :: Type -> Type) a. Bundle m v a -> Stream m a

# Documentation

data Bundle (m :: Type -> Type) (v :: Type -> Type) a #

Monadic streams

Constructors

Bundle |
Fields sElems :: Stream m a sChunks :: Stream m (Chunk v a) sVector :: Maybe (v a) sSize :: Size

#### Instances

Instances details

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 #
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 #
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 :: Type -> Type) a #

Constructors

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

lift :: forall (m :: Type -> Type) (v :: Type -> Type) a. Monad m => Bundle Id v a -> Bundle m v a #

Convert a pure stream to a monadic stream

# Size hints

size :: forall (m :: Type -> Type) (v :: Type -> Type) a. Bundle m v a -> Size #

`Size` hint of a `Bundle`

sized :: forall (m :: Type -> Type) (v :: Type -> Type) a. Bundle m v a -> Size -> Bundle m v a #

Attach a `Size` hint to a `Bundle`

# Length

length :: forall m (v :: Type -> Type) a. Monad m => Bundle m v a -> m Int #

Length of a `Bundle`

null :: forall m (v :: Type -> Type) a. Monad m => Bundle m v a -> m Bool #

Check if a `Bundle` is empty

# Construction

empty :: forall (m :: Type -> Type) (v :: Type -> Type) a. Monad m => Bundle m v a #

Empty `Bundle`

singleton :: forall (m :: Type -> Type) a (v :: Type -> Type). Monad m => a -> Bundle m v a #

Singleton `Bundle`

cons :: forall (m :: Type -> Type) a (v :: Type -> Type). Monad m => a -> Bundle m v a -> Bundle m v a #

Prepend an element

snoc :: forall (m :: Type -> Type) (v :: Type -> Type) a. Monad m => Bundle m v a -> a -> Bundle m v a #

Append an element

replicate :: forall (m :: Type -> Type) a (v :: Type -> Type). Monad m => Int -> a -> Bundle m v a #

Replicate a value to a given length

replicateM :: forall m a (v :: Type -> Type). 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 :: forall (m :: Type -> Type) a (v :: Type -> Type). Monad m => Int -> (Int -> a) -> Bundle m v a #

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

Generate a stream from its indices

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

Concatenate two `Bundle`s

# Accessing elements

head :: forall m (v :: Type -> Type) a. Monad m => Bundle m v a -> m a #

First element of the `Bundle` or error if empty

last :: forall m (v :: Type -> Type) a. Monad m => Bundle m v a -> m a #

Last element of the `Bundle` or error if empty

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

Element at the given position

(!?) :: forall m (v :: Type -> Type) a. 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

:: forall (m :: Type -> Type) (v :: Type -> Type) a. 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 :: forall (m :: Type -> Type) (v :: Type -> Type) a. Monad m => Bundle m v a -> Bundle m v a #

All but the last element

tail :: forall (m :: Type -> Type) (v :: Type -> Type) a. Monad m => Bundle m v a -> Bundle m v a #

All but the first element

take :: forall (m :: Type -> Type) (v :: Type -> Type) a. Monad m => Int -> Bundle m v a -> Bundle m v a #

The first `n` elements

drop :: forall (m :: Type -> Type) (v :: Type -> Type) a. Monad m => Int -> Bundle m v a -> Bundle m v a #

All but the first `n` elements

# Mapping

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

Map a function over a `Bundle`

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

Map a monadic function over a `Bundle`

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

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

trans :: forall m m' (v :: Type -> Type) a. (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 :: forall (m :: Type -> Type) (v :: Type -> Type) a. Monad m => Bundle m v (Box a) -> Bundle m v a #

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

flatten :: forall m a s b (v :: Type -> Type). 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 :: forall (m :: Type -> Type) (v :: Type -> Type) a. Monad m => Bundle m v a -> Bundle m v (Int, a) #

Pair each element in a `Bundle` with its index

indexedR :: forall (m :: Type -> Type) (v :: Type -> Type) a. 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_ :: forall m a b c (v :: Type -> Type). Monad m => (a -> b -> m c) -> Bundle m v a -> Bundle m v b -> m () #

zipWithM :: forall m a b c (v :: Type -> Type). 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 :: forall m a b c d (v :: Type -> Type). Monad m => (a -> b -> c -> m d) -> Bundle m v a -> Bundle m v b -> Bundle m v c -> Bundle m v d #

zipWith4M :: forall m a b c d e (v :: Type -> Type). 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 :: forall m a b c d e f (v :: Type -> Type). 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 :: forall m a b c d e f g (v :: Type -> Type). 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 :: forall (m :: Type -> Type) a b c (v :: Type -> Type). Monad m => (a -> b -> c) -> Bundle m v a -> Bundle m v b -> Bundle m v c #

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

zipWith4 :: forall (m :: Type -> Type) a b c d e (v :: Type -> Type). 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 :: forall (m :: Type -> Type) a b c d e f (v :: Type -> Type). 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 :: forall (m :: Type -> Type) a b c d e f g (v :: Type -> Type). 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 :: forall (m :: Type -> Type) (v :: Type -> Type) a b. Monad m => Bundle m v a -> Bundle m v b -> Bundle m v (a, b) #

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

zip4 :: forall (m :: Type -> Type) (v :: Type -> Type) a b c d. 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 :: forall (m :: Type -> Type) (v :: Type -> Type) a b c d e. 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 :: forall (m :: Type -> Type) (v :: Type -> Type) a b c d e f. 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 :: forall m a b (v :: Type -> Type). Monad m => (a -> b -> Bool) -> Bundle m v a -> Bundle m v b -> m Bool #

Check if two `Bundle`s are equal

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

Lexicographically compare two `Bundle`s

# Filtering

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

Drop elements which do not satisfy the predicate

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

Drop elements which do not satisfy the monadic predicate

mapMaybeM :: forall m a b (v :: Type -> Type). Monad m => (a -> m (Maybe b)) -> Bundle m v a -> Bundle m v b #

Apply monadic function to each element and drop all Nothings

Since: 0.12.2.0

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

Longest prefix of elements that satisfy the predicate

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

Longest prefix of elements that satisfy the monadic predicate

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

Drop the longest prefix of elements that satisfy the predicate

dropWhileM :: forall m a (v :: Type -> Type). 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 :: forall m a (v :: Type -> Type). (Monad m, Eq a) => a -> Bundle m v a -> m Bool infix 4 #

Check whether the `Bundle` contains an element

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

Inverse of `elem`

find :: forall m a (v :: Type -> Type). 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 :: forall m a (v :: Type -> Type). 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 :: forall m a (v :: Type -> Type). 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 :: forall m a (v :: Type -> Type). 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 :: forall m a b (v :: Type -> Type). Monad m => (a -> b -> a) -> a -> Bundle m v b -> m a #

Left fold

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

Left fold with a monadic operator

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

Left fold over a non-empty `Bundle`

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

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

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

Same as `foldlM`

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

Same as `foldl1M`

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

Left fold with a strict accumulator

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

Left fold with a strict accumulator and a monadic operator

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

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

foldl1M' :: forall m a (v :: Type -> Type). 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' :: forall m a b (v :: Type -> Type). Monad m => (a -> b -> m a) -> a -> Bundle m v b -> m a #

Same as `foldlM'`

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

Same as `foldl1M'`

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

Right fold

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

Right fold with a monadic operator

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

Right fold over a non-empty stream

foldr1M :: forall m a (v :: Type -> Type). 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 :: forall m (v :: Type -> Type). Monad m => Bundle m v Bool -> m Bool #

or :: forall m (v :: Type -> Type). Monad m => Bundle m v Bool -> m Bool #

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

# Unfolding

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

Unfold

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

Unfold with a monadic function

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

Unfold at most `n` elements

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

Unfold at most `n` elements with a monadic function.

unfoldrExactN :: forall (m :: Type -> Type) s a (u :: Type -> Type). Monad m => Int -> (s -> (a, s)) -> s -> Bundle m u a #

Unfold exactly `n` elements

Since: 0.12.2.0

unfoldrExactNM :: forall m s a (u :: Type -> Type). Monad m => Int -> (s -> m (a, s)) -> s -> Bundle m u a #

Unfold exactly `n` elements with a monadic function.

Since: 0.12.2.0

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

O(n) Apply function \(\max(n - 1, 0)\) times to an initial value, producing a monadic bundle of exact length \(\max(n, 0)\). Zeroth element will contain the initial value.

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

O(n) Apply monadic function \(\max(n - 1, 0)\) times to an initial value, producing a monadic bundle of exact length \(\max(n, 0)\). Zeroth element will contain the initial value.

# Scans

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

Prefix scan

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

Prefix scan with a monadic operator

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

Prefix scan with strict accumulator

prescanlM' :: forall m a b (v :: Type -> Type). 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 :: forall (m :: Type -> Type) a b (v :: Type -> Type). Monad m => (a -> b -> a) -> a -> Bundle m v b -> Bundle m v a #

Suffix scan

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

Suffix scan with a monadic operator

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

Suffix scan with strict accumulator

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

Suffix scan with strict accumulator and a monadic operator

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

Haskell-style scan

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

Haskell-style scan with a monadic operator

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

Haskell-style scan with strict accumulator

scanlM' :: forall m a b (v :: Type -> Type). 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 :: forall (m :: Type -> Type) a (v :: Type -> Type). Monad m => (a -> a -> a) -> Bundle m v a -> Bundle m v a #

Initial-value free scan over a `Bundle`

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

Initial-value free scan over a `Bundle` with a monadic operator

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

Initial-value free scan over a `Bundle` with a strict accumulator

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

Initial-value free scan over a `Bundle` with a strict accumulator and a monadic operator

# Enumerations

enumFromStepN :: forall a (m :: Type -> Type) (v :: Type -> Type). (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 :: forall a (m :: Type -> Type) (v :: Type -> Type). (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 :: forall a (m :: Type -> Type) (v :: Type -> Type). (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 :: forall m (v :: Type -> Type) a. Monad m => Bundle m v a -> m [a] #

Convert a `Bundle` to a list

fromList :: forall (m :: Type -> Type) a (v :: Type -> Type). Monad m => [a] -> Bundle m v a #

Convert a list to a `Bundle`

fromListN :: forall (m :: Type -> Type) a (v :: Type -> Type). Monad m => Int -> [a] -> Bundle m v a #

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

unsafeFromList :: forall (m :: Type -> Type) a (v :: Type -> Type). Monad m => Size -> [a] -> Bundle m v a #

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

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

reVector :: forall (m :: Type -> Type) (u :: Type -> Type) a (v :: Type -> Type). Monad m => Bundle m u a -> Bundle m v a #

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

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

fromStream :: forall (m :: Type -> Type) a (v :: Type -> Type). Monad m => Stream m a -> Size -> Bundle m v a #

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

elements :: forall (m :: Type -> Type) (v :: Type -> Type) a. Bundle m v a -> Stream m a #