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

Function transformPull

packages/effect/src/Stream.ts:624–636  ·  view source on GitHub ↗
(
  self: Stream<A, E, R>,
  f: (pull: Pull.Pull<Arr.NonEmptyReadonlyArray<A>, E, void>, scope: Scope.Scope) => Effect.Effect<
    Pull.Pull<Arr.NonEmptyReadonlyArray<B>, E2, void, R2>,
    EX,
    RX
  >
)

Source from the content-addressed store, hash-verified

622 * @since 4.0.0
623 */
624export const transformPull = <A, E, R, B, E2, R2, EX, RX>(
625 self: Stream<A, E, R>,
626 f: (pull: Pull.Pull<Arr.NonEmptyReadonlyArray<A>, E, void>, scope: Scope.Scope) => Effect.Effect<
627 Pull.Pull<Arr.NonEmptyReadonlyArray<B>, E2, void, R2>,
628 EX,
629 RX
630 >
631): Stream<B, EX | Pull.ExcludeDone<E2>, R | R2 | RX> =>
632 fromChannel(
633 Channel.fromTransform((_, scope) =>
634 Effect.flatMap(Channel.toPullScoped(self.channel, scope), (pull) => f(pull as any, scope))
635 )
636 )
637
638/**
639 * Transforms a stream by effectfully transforming its pull effect.

Callers 2

Stream.tsFile · 0.70
flattenIterableFunction · 0.70

Calls 2

fromChannelFunction · 0.70
fFunction · 0.50

Tested by

no test coverage detected