MCPcopy
hub / github.com/Effect-TS/effect / unfold

Function unfold

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

Source from the content-addressed store, hash-verified

7400
7401/** @internal */
7402export const unfold = <S, A>(s: S, f: (s: S) => Option.Option<readonly [A, S]>): Stream.Stream<A> =>
7403 unfoldChunk(s, (s) => pipe(f(s), Option.map(([a, s]) => [Chunk.of(a), s])))
7404
7405/** @internal */
7406export const unfoldChunk = <S, A>(

Callers 1

iterateFunction · 0.70

Calls 5

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

Tested by

no test coverage detected