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

Streamly.Internal.Data.Stream.StreamD.Transform

Description

Streamly.Internal.Data.Pipe might ultimately replace this module.

Synopsis

Piping

Pass through a Pipe.

transform :: Monad m => Pipe m a b -> Stream m a -> Stream m b Source #

Mapping

Stateless one-to-one maps.

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

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

Map a monadic function over a Stream

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

Mapping Effects

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

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

tapRate :: (MonadAsync m, MonadCatch m) => Double -> (Int -> m b) -> Stream m a -> Stream m a Source #

pollCounts :: MonadAsync m => (a -> Bool) -> (Stream m Int -> Stream m Int) -> Fold m Int b -> Stream m a -> Stream m a Source #

Folding

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

foldrT :: (Monad m, Monad (t m), MonadTrans t) => (a -> t m b -> t m b) -> t m b -> Stream m a -> t m b Source #

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

foldlT :: (Monad m, Monad (s m), MonadTrans s) => (s m b -> a -> s m b) -> s m b -> Stream m a -> s m b Source #

Scanning By Fold

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

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

Scanning

Left scans. Stateful, mostly one-to-one maps.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Filtering

Produce a subset of the stream.

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

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

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

uniq :: (Eq a, Monad m) => Stream m a -> Stream m a Source #

Trimming

Produce a subset of the stream trimmed at ends.

take :: Applicative m => Int -> Stream m a -> Stream m a Source #

takeByTime :: (MonadIO m, TimeUnit64 t) => t -> Stream m a -> Stream m a Source #

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

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

drop :: Monad m => Int -> Stream m a -> Stream m a Source #

dropByTime :: (MonadIO m, TimeUnit64 t) => t -> Stream m a -> Stream m a Source #

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

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

Inserting Elements

Produce a superset of the stream.

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

intersperse :: Monad m => a -> Stream m a -> Stream m a Source #

intersperseM :: Monad m => m a -> Stream m a -> Stream m a Source #

intersperseSuffix :: forall m a. Monad m => m a -> Stream m a -> Stream m a Source #

intersperseSuffixBySpan :: forall m a. Monad m => Int -> m a -> Stream m a -> Stream m a Source #

intersperse after every n items

Inserting Side Effects

intersperseM_ :: Monad m => m b -> Stream m a -> Stream m a Source #

intersperseSuffix_ :: Monad m => m b -> Stream m a -> Stream m a Source #

Reordering

Produce strictly the same set but reordered.

reverse :: Monad m => Stream m a -> Stream m a Source #

Position Indexing

indexed :: Monad m => Stream m a -> Stream m (Int, a) Source #

indexedR :: Monad m => Int -> Stream m a -> Stream m (Int, a) Source #

Searching

findIndices :: Monad m => (a -> Bool) -> Stream m a -> Stream m Int Source #

slicesBy :: Monad m => (a -> Bool) -> Stream m a -> Stream m (Int, Int) Source #

Rolling map

Map using the previous element.

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

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

Maybe Streams

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

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