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

Function fromTransform

packages/effect/src/Channel.ts:311–329  ·  view source on GitHub ↗
(
  transform: (
    upstream: Pull.Pull<InElem, InErr, InDone>,
    scope: Scope.Scope
  ) => Effect.Effect<Pull.Pull<OutElem, OutErr, OutDone, EnvX>, EX, Env>
)

Source from the content-addressed store, hash-verified

309 * @since 4.0.0
310 */
311export const fromTransform = <OutElem, OutErr, OutDone, InElem, InErr, InDone, EX, EnvX, Env>(
312 transform: (
313 upstream: Pull.Pull<InElem, InErr, InDone>,
314 scope: Scope.Scope
315 ) => Effect.Effect<Pull.Pull<OutElem, OutErr, OutDone, EnvX>, EX, Env>
316): Channel<
317 OutElem,
318 Pull.ExcludeDone<OutErr> | EX,
319 OutDone,
320 InElem,
321 InErr,
322 InDone,
323 Env | EnvX
324> => {
325 const self = Object.create(ChannelProto)
326 self.transform = (upstream: any, scope: Scope.Scope) =>
327 Effect.catchCause(transform(upstream, scope), (cause) => Effect.succeed(Effect.failCause(cause)))
328 return self
329}
330
331/**
332 * Transforms a Channel by applying a function to its Pull implementation.

Callers 15

transformPullFunction · 0.70
fromPullFunction · 0.70
fromTransformBracketFunction · 0.70
callbackFunction · 0.70
callbackArrayFunction · 0.70
suspendFunction · 0.70
identityFunction · 0.70
fromReadableStreamFunction · 0.70
fromWritableStreamFunction · 0.70
fromTransformStreamFunction · 0.70
fromAsyncIterableFunction · 0.70
mapEffectSequentialFunction · 0.70

Calls 2

transformFunction · 0.70
succeedMethod · 0.45

Tested by

no test coverage detected