repeat package:streamly-core

Generate an infinite stream by repeating a pure value.
>>> repeat = Stream.iterate id

>>> repeat x = Stream.repeatM (pure x)
Generate an infinite stream by repeating a pure value.
>>> repeat x = let xs = StreamK.cons x xs in xs
Pre-release
>>> repeatM act = Stream.iterateM (const act) act

>>> repeatM = Stream.sequence . Stream.repeat
Generate a stream by repeatedly executing a monadic action forever.
>>> :{
repeatAction =
Stream.repeatM (threadDelay 1000000 >> print 1)
& Stream.take 10
& Stream.fold Fold.drain
:}
Generates an infinite stream repeating the seed.
Emit only repeated elements, once. Unimplemented
Emit only repeated elements, once. Unimplemented
Emit only repeated elements, once. Unimplemented
>>> repeatM = StreamK.sequence . StreamK.repeat

>>> repeatM = fix . StreamK.consM

>>> repeatM = cycle1 . StreamK.fromEffect
Generate a stream by repeatedly executing a monadic action forever.
>>> :{
repeatAction =
StreamK.repeatM (threadDelay 1000000 >> print 1)
& StreamK.take 10
& StreamK.fold Fold.drain
:}
Like repeatM but takes a stream cons operation to combine the actions in a stream specific manner. A serial cons would repeat the values serially while an async cons would repeat concurrently. Pre-release
Takes a tuple whose first element is repeated and the second element is passed through the supplied unfold.
>>> zipRepeat = fmap (\(x,y) -> (fst x, y)) . Unfold.carry . Unfold.lmap snd

>>> zipRepeat = Unfold.zipArrowWith (,) Unfold.repeat