MCPcopy Index your code
hub / github.com/Effect-TS/effect / unfoldEffect

Function unfoldEffect

packages/effect/src/internal/stream.ts:7438–7442  ·  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

7436
7437/** @internal */
7438export const unfoldEffect = <S, A, E, R>(
7439 s: S,
7440 f: (s: S) => Effect.Effect<Option.Option<readonly [A, S]>, E, R>
7441): Stream.Stream<A, E, R> =>
7442 unfoldChunkEffect(s, (s) => pipe(f(s), Effect.map(Option.map(([a, s]) => [Chunk.of(a), s]))))
7443
7444const void_: Stream.Stream<void> = succeed(void 0)
7445export {

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