MCPcopy Index your code
hub / github.com/Effect-TS/effect / match

Function match

packages/effect/src/internal/concurrency.ts:6–30  ·  view source on GitHub ↗
(
  concurrency: Concurrency | undefined,
  sequential: () => Effect<A, E, R>,
  unbounded: () => Effect<A, E, R>,
  bounded: (limit: number) => Effect<A, E, R>
)

Source from the content-addressed store, hash-verified

4
5/** @internal */
6export const match = <A, E, R>(
7 concurrency: Concurrency | undefined,
8 sequential: () => Effect<A, E, R>,
9 unbounded: () => Effect<A, E, R>,
10 bounded: (limit: number) => Effect<A, E, R>
11): Effect<A, E, R> => {
12 switch (concurrency) {
13 case undefined:
14 return sequential()
15 case "unbounded":
16 return unbounded()
17 case "inherit":
18 return core.fiberRefGetWith(
19 core.currentConcurrency,
20 (concurrency) =>
21 concurrency === "unbounded" ?
22 unbounded() :
23 concurrency > 1 ?
24 bounded(concurrency) :
25 sequential()
26 )
27 default:
28 return concurrency > 1 ? bounded(concurrency) : sequential()
29 }
30}
31
32/** @internal */
33export const matchSimple = <A, E, R>(

Callers 12

core-effect.tsFile · 0.70
layer.tsFile · 0.70
matcher.tsFile · 0.70
typeTagsFunction · 0.70
flipCauseOptionFunction · 0.70
keepDefectsFunction · 0.70
linearizeFunction · 0.70
stripFailuresFunction · 0.70
electFailuresFunction · 0.70
cause.tsFile · 0.70
stm.tsFile · 0.50

Calls 3

sequentialFunction · 0.70
unboundedFunction · 0.70
boundedFunction · 0.70

Tested by

no test coverage detected