streamly-core-0.1.0: Streaming, parsers, arrays and more
Copyright(c) 2017 Composewell Technologies
LicenseBSD-3-Clause
Maintainerstreamly@composewell.com
Stabilityexperimental
PortabilityGHC
Safe HaskellSafe-Inferred
LanguageHaskell2010

Streamly.Internal.Data.Stream.Common

Description

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

Synopsis

Conversion operations

fromList :: Monad m => [a] -> StreamK 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.

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

Convert a stream into a list in the underlying monad.

Fold operations

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

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

Strict left associative fold.

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

Zip style operations

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

Compare two streams for equality

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

Compare two streams