streamly-0.8.2: Dataflow programming and declarative concurrency
Copyright(c) 2017 Composewell Technologies
LicenseBSD-3-Clause
Maintainerstreamly@composewell.com
Stabilityexperimental
PortabilityGHC
Safe HaskellNone
LanguageHaskell2010

Streamly.Internal.Data.Stream.Prelude

Description

Low level functions using StreamK as the intermediate stream type. These functions are used in SerialTAsyncTAheadT/ParallelT stream modules to implement their instances..

Synopsis

Running Effects

drain :: Monad m => Stream m a -> m () Source #

Conversion operations

fromList :: Monad m => [a] -> Stream m a Source #

fromList = foldr cons nil

Construct a stream from a list of pure values. This is more efficient than fromFoldable for serial streams.

Since: 0.4.0

toList :: Monad m => Stream m a -> m [a] Source #

Convert a stream into a list in the underlying monad.

Since: 0.1.0

Fold operations

foldrM :: Monad m => (a -> m b -> m b) -> m b -> Stream m a -> m b Source #

foldrMx :: Monad m => (a -> m x -> m x) -> m x -> (m x -> m b) -> Stream m a -> m b Source #

foldr :: Monad m => (a -> b -> b) -> b -> Stream m a -> m b Source #

foldlx' :: Monad m => (x -> a -> x) -> x -> (x -> b) -> Stream m a -> m b Source #

Strict left fold with an extraction function. Like the standard strict left fold, but applies a user supplied extraction function (the third argument) to the folded value at the end. This is designed to work with the foldl library. The suffix x is a mnemonic for extraction.

Since: 0.7.0

foldlMx' :: Monad m => (x -> a -> m x) -> m x -> (x -> m b) -> Stream m a -> m b Source #

Like foldlx', but with a monadic step function.

Since: 0.7.0

foldl' :: Monad m => (b -> a -> b) -> b -> Stream m a -> m b Source #

Strict left associative fold.

Since: 0.2.0

fold :: Monad m => Fold m a b -> Stream m a -> m b Source #

Zip style operations

eqBy :: Monad m => (a -> b -> Bool) -> Stream m a -> Stream m b -> m Bool Source #

Compare two streams for equality

Since: 0.5.3

cmpBy :: Monad m => (a -> b -> Ordering) -> Stream m a -> Stream m b -> m Ordering Source #

Compare two streams

Since: 0.5.3