MCPcopy Create free account
hub / github.com/effect-app/libs / mapEffectConcurrent

Function mapEffectConcurrent

repos/effect/packages/effect/src/Channel.ts:1957–2054  ·  view source on GitHub ↗
(
  self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>,
  f: (o: OutElem, i: number) => Effect.Effect<OutElem2, EX, RX>,
  options: {
    readonly concurrency: number | "unbounded"
    readonly unordered?: boolean | undefined
  }
)

Source from the content-addressed store, hash-verified

1955 <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env, OutElem2>(
1956 self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>,
1957 f: (o: OutElem, i: number) => OutElem2
1958 ): Channel<OutElem2, OutErr, OutDone, InElem, InErr, InDone, Env> =>
1959 transformPull(self, (pull) =>
1960 Effect.sync(() => {
1961 let i = 0
1962 return Effect.map(pull, (o) => f(o, i++))
1963 }))
1964)
1965
1966/**
1967 * Maps the done value of this channel using the specified function.
1968 *
1969 * @category sequencing
1970 * @since 4.0.0
1971 */
1972export const mapDone: {
1973 <OutDone, OutDone2>(
1974 f: (o: OutDone) => OutDone2
1975 ): <OutElem, OutErr, InElem, InErr, InDone, Env>(
1976 self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>
1977 ) => Channel<OutElem, OutErr, OutDone2, InElem, InErr, InDone, Env>
1978 <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env, OutDone2>(
1979 self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>,
1980 f: (o: OutDone) => OutDone2
1981 ): Channel<OutElem, OutErr, OutDone2, InElem, InErr, InDone, Env>
1982} = dual(
1983 2,
1984 <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env, OutDone2>(
1985 self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>,
1986 f: (o: OutDone) => OutDone2
1987 ): Channel<OutElem, OutErr, OutDone2, InElem, InErr, InDone, Env> => mapDoneEffect(self, (o) => Effect.succeed(f(o)))
1988)
1989
1990/**
1991 * Maps the done value of this channel using the specified effectful function.
1992 *
1993 * **When to use**
1994 *
1995 * Use when the terminal done value transformation needs services or can fail,
1996 * while emitted elements should pass through unchanged.
1997 *
1998 * @category sequencing
1999 * @since 4.0.0
2000 */
2001export const mapDoneEffect: {
2002 <OutDone, OutDone2, E, R>(
2003 f: (o: OutDone) => Effect.Effect<OutDone2, E, R>
2004 ): <OutElem, OutErr, InElem, InErr, InDone, Env>(
2005 self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>
2006 ) => Channel<OutElem, OutErr | E, OutDone2, InElem, InErr, InDone, Env | R>
2007 <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env, OutDone2, E, R>(
2008 self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>,
2009 f: (o: OutDone) => Effect.Effect<OutDone2, E, R>
2010 ): Channel<OutElem, OutErr | E, OutDone2, InElem, InErr, InDone, Env | R>
2011} = dual(
2012 2,
2013 <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env, OutDone2, E, R>(
2014 self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>,

Callers 1

Channel.tsFile · 0.85

Calls 15

constantFunction · 0.90
fromTransformBracketFunction · 0.85
toTransformFunction · 0.85
runForkFunction · 0.85
addFinalizerMethod · 0.80
offerMethod · 0.80
addObserverMethod · 0.80
joinMethod · 0.80
contextMethod · 0.65
releaseMethod · 0.65
pipeMethod · 0.65
takeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…