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

Function forEachWhileArray

packages/effect/src/Sink.ts:1874–1884  ·  view source on GitHub ↗
(
  f: (input: NonEmptyReadonlyArray<In>) => Effect.Effect<boolean, E, R>
)

Source from the content-addressed store, hash-verified

1872 * @since 4.0.0
1873 */
1874export const forEachWhileArray = <In, E, R>(
1875 f: (input: NonEmptyReadonlyArray<In>) => Effect.Effect<boolean, E, R>
1876): Sink<void, In, never, E, R> =>
1877 fromTransform((upstream) =>
1878 upstream.pipe(
1879 Effect.flatMap(f),
1880 Effect.flatMap((cont) => cont ? Effect.void : Cause.done()),
1881 Effect.forever({ disableYield: true }),
1882 Pull.catchDone(() => endVoid)
1883 )
1884 )
1885
1886/**
1887 * Creates a sink produced from a scoped effect.

Callers 1

forEachWhileFunction · 0.85

Calls 3

fromTransformFunction · 0.70
pipeMethod · 0.65
doneMethod · 0.45

Tested by

no test coverage detected