|
Data.Vector.Fusion.Stream | Portability | non-portable | Stability | experimental | Maintainer | Roman Leshchinskiy <rl@cse.unsw.edu.au> |
|
|
|
|
|
Description |
Streams for stream fusion
|
|
Synopsis |
|
| | type Stream = Stream Id | | type MStream = Stream | | inplace :: (forall m. Monad m => Stream m a -> Stream m b) -> Stream a -> Stream b | | size :: Stream a -> Size | | sized :: Stream a -> Size -> Stream a | | length :: Stream a -> Int | | null :: Stream a -> Bool | | empty :: Stream a | | singleton :: a -> Stream a | | cons :: a -> Stream a -> Stream a | | snoc :: Stream a -> a -> Stream a | | replicate :: Int -> a -> Stream a | | generate :: Int -> (Int -> a) -> Stream a | | (++) :: Stream a -> Stream a -> Stream a | | head :: Stream a -> a | | last :: Stream a -> a | | (!!) :: Stream a -> Int -> a | | slice :: Int -> Int -> Stream a -> Stream a | | init :: Stream a -> Stream a | | tail :: Stream a -> Stream a | | take :: Int -> Stream a -> Stream a | | drop :: Int -> Stream a -> Stream a | | map :: (a -> b) -> Stream a -> Stream b | | concatMap :: (a -> Stream b) -> Stream a -> Stream b | | unbox :: Stream (Box a) -> Stream a | | indexed :: Stream a -> Stream (Int, a) | | indexedR :: Int -> Stream a -> Stream (Int, a) | | zipWith :: (a -> b -> c) -> Stream a -> Stream b -> Stream c | | zipWith3 :: (a -> b -> c -> d) -> Stream a -> Stream b -> Stream c -> Stream d | | zipWith4 :: (a -> b -> c -> d -> e) -> Stream a -> Stream b -> Stream c -> Stream d -> Stream e | | zipWith5 :: (a -> b -> c -> d -> e -> f) -> Stream a -> Stream b -> Stream c -> Stream d -> Stream e -> Stream f | | zipWith6 :: (a -> b -> c -> d -> e -> f -> g) -> Stream a -> Stream b -> Stream c -> Stream d -> Stream e -> Stream f -> Stream g | | zip :: Stream a -> Stream b -> Stream (a, b) | | zip3 :: Stream a -> Stream b -> Stream c -> Stream (a, b, c) | | zip4 :: Stream a -> Stream b -> Stream c -> Stream d -> Stream (a, b, c, d) | | zip5 :: Stream a -> Stream b -> Stream c -> Stream d -> Stream e -> Stream (a, b, c, d, e) | | zip6 :: Stream a -> Stream b -> Stream c -> Stream d -> Stream e -> Stream f -> Stream (a, b, c, d, e, f) | | filter :: (a -> Bool) -> Stream a -> Stream a | | takeWhile :: (a -> Bool) -> Stream a -> Stream a | | dropWhile :: (a -> Bool) -> Stream a -> Stream a | | elem :: Eq a => a -> Stream a -> Bool | | notElem :: Eq a => a -> Stream a -> Bool | | find :: (a -> Bool) -> Stream a -> Maybe a | | findIndex :: (a -> Bool) -> Stream a -> Maybe Int | | foldl :: (a -> b -> a) -> a -> Stream b -> a | | foldl1 :: (a -> a -> a) -> Stream a -> a | | foldl' :: (a -> b -> a) -> a -> Stream b -> a | | foldl1' :: (a -> a -> a) -> Stream a -> a | | foldr :: (a -> b -> b) -> b -> Stream a -> b | | foldr1 :: (a -> a -> a) -> Stream a -> a | | and :: Stream Bool -> Bool | | or :: Stream Bool -> Bool | | unfoldr :: (s -> Maybe (a, s)) -> s -> Stream a | | unfoldrN :: Int -> (s -> Maybe (a, s)) -> s -> Stream a | | prescanl :: (a -> b -> a) -> a -> Stream b -> Stream a | | prescanl' :: (a -> b -> a) -> a -> Stream b -> Stream a | | postscanl :: (a -> b -> a) -> a -> Stream b -> Stream a | | postscanl' :: (a -> b -> a) -> a -> Stream b -> Stream a | | scanl :: (a -> b -> a) -> a -> Stream b -> Stream a | | scanl' :: (a -> b -> a) -> a -> Stream b -> Stream a | | scanl1 :: (a -> a -> a) -> Stream a -> Stream a | | scanl1' :: (a -> a -> a) -> Stream a -> Stream a | | enumFromStepN :: Num a => a -> a -> Int -> Stream a | | enumFromTo :: Enum a => a -> a -> Stream a | | enumFromThenTo :: Enum a => a -> a -> a -> Stream a | | toList :: Stream a -> [a] | | fromList :: [a] -> Stream a | | fromListN :: Int -> [a] -> Stream a | | unsafeFromList :: Size -> [a] -> Stream a | | liftStream :: Monad m => Stream a -> Stream m a | | mapM :: Monad m => (a -> m b) -> Stream a -> Stream m b | | mapM_ :: Monad m => (a -> m b) -> Stream a -> m () | | zipWithM :: Monad m => (a -> b -> m c) -> Stream a -> Stream b -> Stream m c | | zipWithM_ :: Monad m => (a -> b -> m c) -> Stream a -> Stream b -> m () | | filterM :: Monad m => (a -> m Bool) -> Stream a -> Stream m a | | foldM :: Monad m => (a -> b -> m a) -> a -> Stream b -> m a | | fold1M :: Monad m => (a -> a -> m a) -> Stream a -> m a | | foldM' :: Monad m => (a -> b -> m a) -> a -> Stream b -> m a | | fold1M' :: Monad m => (a -> a -> m a) -> Stream a -> m a | | eq :: Eq a => Stream a -> Stream a -> Bool | | cmp :: Ord a => Stream a -> Stream a -> Ordering |
|
|
|
Types
|
|
|
Result of taking a single step in a stream
| Constructors | Yield a s | a new element and a new seed
| Skip s | just a new seed
| Done | end of stream
|
|
|
|
|
The type of pure streams
|
|
|
Alternative name for monadic streams
|
|
In-place markers
|
|
|
|
Size hints
|
|
|
Size hint of a Stream
|
|
|
Attach a Size hint to a Stream
|
|
Length information
|
|
|
Length of a Stream
|
|
|
Check if a Stream is empty
|
|
Construction
|
|
|
Empty Stream
|
|
|
Singleton Stream
|
|
|
Prepend an element
|
|
|
Append an element
|
|
|
Replicate a value to a given length
|
|
|
Generate a stream from its indices
|
|
|
Concatenate two Streams
|
|
Accessing individual elements
|
|
|
First element of the Stream or error if empty
|
|
|
Last element of the Stream or error if empty
|
|
|
Element at the given position
|
|
Substreams
|
|
|
:: Int | starting index
| -> Int | length
| -> Stream a | | -> Stream a | | Extract a substream of the given length starting at the given position.
|
|
|
|
All but the last element
|
|
|
All but the first element
|
|
|
The first n elements
|
|
|
All but the first n elements
|
|
Mapping
|
|
|
Map a function over a Stream
|
|
|
|
|
|
Zipping
|
|
|
Pair each element in a Stream with its index
|
|
|
Pair each element in a Stream with its index, starting from the right
and counting down
|
|
|
Zip two Streams with the given function
|
|
|
Zip three Streams with the given function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Filtering
|
|
|
Drop elements which do not satisfy the predicate
|
|
|
Longest prefix of elements that satisfy the predicate
|
|
|
Drop the longest prefix of elements that satisfy the predicate
|
|
Searching
|
|
|
Check whether the Stream contains an element
|
|
|
Inverse of elem
|
|
|
Yield Just the first element matching the predicate or Nothing if no
such element exists.
|
|
|
Yield Just the index of the first element matching the predicate or
Nothing if no such element exists.
|
|
Folding
|
|
|
Left fold
|
|
|
Left fold on non-empty Streams
|
|
|
Left fold with strict accumulator
|
|
|
Left fold on non-empty Streams with strict accumulator
|
|
|
Right fold
|
|
|
Right fold on non-empty Streams
|
|
Specialised folds
|
|
|
|
|
|
Unfolding
|
|
|
Unfold
|
|
|
Unfold at most n elements
|
|
Scans
|
|
|
Prefix scan
|
|
|
Prefix scan with strict accumulator
|
|
|
Suffix scan
|
|
|
Suffix scan with strict accumulator
|
|
|
Haskell-style scan
|
|
|
Haskell-style scan with strict accumulator
|
|
|
Scan over a non-empty Stream
|
|
|
Scan over a non-empty Stream with a strict accumulator
|
|
Enumerations
|
|
|
Yield a Stream of the given length containing the values x, x+y,
x+y+y etc.
|
|
|
Enumerate values
WARNING: This operations can be very inefficient. If at all possible, use
enumFromStepN instead.
|
|
|
Enumerate values with a given step.
WARNING: This operations is very inefficient. If at all possible, use
enumFromStepN instead.
|
|
Conversions
|
|
|
Convert a Stream to a list
|
|
|
Create a Stream from a list
|
|
|
Create a Stream from the first n elements of a list
fromListN n xs = fromList (take n xs)
|
|
|
|
|
Convert a pure stream to a monadic stream
|
|
Monadic combinators
|
|
|
Apply a monadic action to each element of the stream, producing a monadic
stream of results
|
|
|
Apply a monadic action to each element of the stream
|
|
|
|
|
|
|
Yield a monadic stream of elements that satisfy the monadic predicate
|
|
|
Monadic fold
|
|
|
Monadic fold over non-empty stream
|
|
|
Monadic fold with strict accumulator
|
|
|
Monad fold over non-empty stream with strict accumulator
|
|
|
Check if two Streams are equal
|
|
|
Lexicographically compare two Streams
|
|
Produced by Haddock version 2.6.1 |