MCPcopy Create free account
hub / github.com/Effect-TS/effect / unfoldEffect

Function unfoldEffect

packages/effect/src/internal/stream.ts:7476–7480  ·  view source on GitHub ↗
(
  s: S,
  f: (s: S) => Effect.Effect<Option.Option<readonly [A, S]>, E, R>
)

Source from the content-addressed store, hash-verified

7474
7475/** @internal */
7476export const unfoldEffect = <S, A, E, R>(
7477 s: S,
7478 f: (s: S) => Effect.Effect<Option.Option<readonly [A, S]>, E, R>
7479): Stream.Stream<A, E, R> =>
7480 unfoldChunkEffect(s, (s) => pipe(f(s), Effect.map(Option.map(([a, s]) => [Chunk.of(a), s]))))
7481
7482const void_: Stream.Stream<void> = succeed(void 0)
7483export {

Callers 2

stream.tsFile · 0.70
repeatEffectWithScheduleFunction · 0.70

Calls 5

unfoldChunkEffectFunction · 0.85
pipeFunction · 0.70
mapMethod · 0.65
ofMethod · 0.65
fFunction · 0.50

Tested by

no test coverage detected