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

Stability | experimental |

Maintainer | Roman Leshchinskiy <rl@cse.unsw.edu.au> |

Streams for stream fusion

- data Step s a
- type Stream = Stream Id
- type MStream = Stream
- inplace :: (forall m. Monad m => Stream m a -> Stream m a) -> Stream a -> Stream a
- 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
- (++) :: Stream a -> Stream a -> Stream a
- head :: Stream a -> a
- last :: Stream a -> a
- (!!) :: Stream a -> Int -> a
- extract :: Stream a -> Int -> Int -> 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
- zipWith :: (a -> b -> c) -> Stream a -> Stream b -> Stream c
- zipWith3 :: (a -> b -> c -> d) -> Stream a -> Stream b -> Stream c -> Stream d
- 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
- 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
- toList :: Stream a -> [a]
- fromList :: [a] -> Stream a
- liftStream :: Monad m => Stream a -> Stream m a
- mapM_ :: Monad m => (a -> m ()) -> Stream a -> m ()
- 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

# Types

Result of taking a single step in a stream

# In-place markers

# Size hints

# Length information

# Construction

# Accessing individual elements

# Substreams

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

# Mapping

# Zipping

zipWith :: (a -> b -> c) -> Stream a -> Stream b -> Stream cSource

Zip two `Stream`

s with the given function

zipWith3 :: (a -> b -> c -> d) -> Stream a -> Stream b -> Stream c -> Stream dSource

Zip three `Stream`

s with the given function

# Filtering

takeWhile :: (a -> Bool) -> Stream a -> Stream aSource

Longest prefix of elements that satisfy the predicate

dropWhile :: (a -> Bool) -> Stream a -> Stream aSource

Drop the longest prefix of elements that satisfy the predicate

# Searching

# Folding

foldl1' :: (a -> a -> a) -> Stream a -> aSource

Left fold on non-empty `Stream`

s with strict accumulator

# Specialised folds

# Unfolding

# Scans

postscanl' :: (a -> b -> a) -> a -> Stream b -> Stream aSource

Suffix scan with strict accumulator

scanl' :: (a -> b -> a) -> a -> Stream b -> Stream aSource

Haskell-style scan with strict accumulator

scanl1' :: (a -> a -> a) -> Stream a -> Stream aSource

Scan over a non-empty `Stream`

with a strict accumulator

# Conversions

liftStream :: Monad m => Stream a -> Stream m aSource

Convert a pure stream to a monadic stream

# Monadic combinators

mapM_ :: Monad m => (a -> m ()) -> Stream a -> m ()Source

Apply a monadic action to each element of the stream