| 1925 | } |
| 1926 | |
| 1927 | const allEither = ( |
| 1928 | effects: Iterable<Effect.Effect<any, any, any>>, |
| 1929 | reconcile: Option.Option<(as: ReadonlyArray<any>) => any>, |
| 1930 | options?: { |
| 1931 | readonly concurrency?: Concurrency | undefined |
| 1932 | readonly batching?: boolean | "inherit" | undefined |
| 1933 | readonly discard?: boolean | undefined |
| 1934 | readonly mode?: "default" | "validate" | "either" | undefined |
| 1935 | readonly concurrentFinalizers?: boolean | undefined |
| 1936 | } |
| 1937 | ) => { |
| 1938 | const eitherEffects: Array<Effect.Effect<Either.Either<unknown, unknown>, never, unknown>> = [] |
| 1939 | for (const effect of effects) { |
| 1940 | eitherEffects.push(core.either(effect)) |
| 1941 | } |
| 1942 | |
| 1943 | if (options?.discard) { |
| 1944 | return forEach(eitherEffects, identity, { |
| 1945 | concurrency: options?.concurrency, |
| 1946 | batching: options?.batching, |
| 1947 | discard: true, |
| 1948 | concurrentFinalizers: options?.concurrentFinalizers |
| 1949 | }) |
| 1950 | } |
| 1951 | |
| 1952 | return core.map( |
| 1953 | forEach(eitherEffects, identity, { |
| 1954 | concurrency: options?.concurrency, |
| 1955 | batching: options?.batching, |
| 1956 | concurrentFinalizers: options?.concurrentFinalizers |
| 1957 | }), |
| 1958 | (eithers) => |
| 1959 | reconcile._tag === "Some" ? |
| 1960 | reconcile.value(eithers) : |
| 1961 | eithers |
| 1962 | ) |
| 1963 | } |
| 1964 | |
| 1965 | /* @internal */ |
| 1966 | export const all = < |