Hoogle Search
Within LTS Haskell 24.40 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
foldMany :: forall (m :: Type -> Type) a b . Monad m => Fold m a b -> Stream m a -> Stream m bstreamly-core Streamly.Internal.Data.Stream Apply a Fold repeatedly on a stream and emit the results in the output stream. Definition:
>>> foldMany f = Stream.parseMany (Parser.fromFold f)
Example, empty stream:>>> f = Fold.take 2 Fold.sum >>> fmany = Stream.fold Fold.toList . Stream.foldMany f >>> fmany $ Stream.fromList [] []
Example, last fold empty:>>> fmany $ Stream.fromList [1..4] [3,7]
Example, last fold non-empty:>>> fmany $ Stream.fromList [1..5] [3,7,5]
Note that using a closed fold e.g. Fold.take 0, would result in an infinite stream on a non-empty input stream.foldMany :: forall (m :: Type -> Type) a b . Monad m => Fold m a b -> Stream m a -> Stream m bstreamly-core Streamly.Internal.Data.Stream Apply a Fold repeatedly on a stream and emit the results in the output stream. Definition:
>>> foldMany f = Stream.parseMany (Parser.fromFold f)
Example, empty stream:>>> f = Fold.take 2 Fold.sum >>> fmany = Stream.fold Fold.toList . Stream.foldMany f >>> fmany $ Stream.fromList [] []
Example, last fold empty:>>> fmany $ Stream.fromList [1..4] [3,7]
Example, last fold non-empty:>>> fmany $ Stream.fromList [1..5] [3,7,5]
Note that using a closed fold e.g. Fold.take 0, would result in an infinite stream on a non-empty input stream.foldManyPost :: forall (m :: Type -> Type) a b . Monad m => Fold m a b -> Stream m a -> Stream m bstreamly-core Streamly.Internal.Data.Stream Like foldMany but evaluates the fold even if the fold did not receive any input, therefore, always results in a non-empty output even on an empty stream (default result of the fold). Example, empty stream:
>>> f = Fold.take 2 Fold.sum >>> fmany = Stream.fold Fold.toList . Stream.foldManyPost f >>> fmany $ Stream.fromList [] [0]
Example, last fold empty:>>> fmany $ Stream.fromList [1..4] [3,7,0]
Example, last fold non-empty:>>> fmany $ Stream.fromList [1..5] [3,7,5]
Note that using a closed fold e.g. Fold.take 0, would result in an infinite stream without consuming the input. Pre-release-
streamly-core Streamly.Internal.Data.Stream Apply a Parser repeatedly on a stream and emit the parsed values in the output stream. Example:
>>> s = Stream.fromList [1..10] >>> parser = Parser.takeBetween 0 2 Fold.sum >>> Stream.fold Fold.toList $ Stream.parseMany parser s [Right 3,Right 7,Right 11,Right 15,Right 19]
This is the streaming equivalent of the many parse combinator. Known Issues: When the parser fails there is no way to get the remaining stream. -
streamly-core Streamly.Internal.Data.Stream No documentation available.
-
streamly-core Streamly.Internal.Data.Stream parseManyTill collect test stream tries the parser test on the input, if test fails it backtracks and tries collect, after collect succeeds test is tried again and so on. The parser stops when test succeeds. The output of test is discarded and the output of collect is emitted in the output stream. The parser fails if collect fails. Unimplemented
refoldMany :: Monad m => Refold m x a b -> m x -> Stream m a -> Stream m bstreamly-core Streamly.Internal.Data.Stream Like foldMany but for the Refold type. The supplied action is used as the initial value for each refold. Internal
refoldMany :: Monad m => Refold m x a b -> m x -> Stream m a -> Stream m bstreamly-core Streamly.Internal.Data.Stream Like foldMany but for the Refold type. The supplied action is used as the initial value for each refold. Internal
scanMany :: forall (m :: Type -> Type) a b . Monad m => Fold m a b -> Stream m a -> Stream m bstreamly-core Streamly.Internal.Data.Stream Like scan but restarts scanning afresh when the scanning fold terminates.
splitOnAny :: forall a (m :: Type -> Type) b . [Array a] -> Fold m a b -> Stream m a -> Stream m bstreamly-core Streamly.Internal.Data.Stream Split on any one of the given patterns. Unimplemented