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

Function fromTransform

packages/effect/src/Channel.ts:283–301  ·  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

281 * @since 4.0.0
282 */
283export const fromTransform = <OutElem, OutErr, OutDone, InElem, InErr, InDone, EX, EnvX, Env>(
284 transform: (
285 upstream: Pull.Pull<InElem, InErr, InDone>,
286 scope: Scope.Scope
287 ) => Effect.Effect<Pull.Pull<OutElem, OutErr, OutDone, EnvX>, EX, Env>
288): Channel<
289 OutElem,
290 Pull.ExcludeDone<OutErr> | EX,
291 OutDone,
292 InElem,
293 InErr,
294 InDone,
295 Env | EnvX
296> => {
297 const self = Object.create(ChannelProto)
298 self.transform = (upstream: any, scope: Scope.Scope) =>
299 Effect.catchCause(transform(upstream, scope), (cause) => Effect.succeed(Effect.failCause(cause)))
300 return self
301}
302
303/**
304 * Transforms a Channel by applying a function to its Pull implementation.

Callers 14

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