( concurrency: Concurrency | undefined, sequential: () => Effect<A, E, R>, unbounded: () => Effect<A, E, R>, bounded: (limit: number) => Effect<A, E, R> )
| 4 | |
| 5 | /** @internal */ |
| 6 | export 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 */ |
| 33 | export const matchSimple = <A, E, R>( |
no test coverage detected