import * as tsplus_module_1 from "@effect/core/io/Effect/operations/succeedNow";
import * as tsplus_module_2 from "@effect/core/io/Effect/operations/fail";
import * as tsplus_module_3 from "@tsplus/stdlib/data/Either/fold";
import * as tsplus_module_4 from "@effect/core/stream/Stream/operations/mapEffect";
/**
 * Fails with given error 'e' if value is `Right`.
 *
 * @tsplus fluent ets/Stream leftOrFail
 */

export function leftOrFail_(self, e, __tsplusTrace) {
  return tsplus_module_4.mapEffect_(self, either => tsplus_module_3.fold_(either, tsplus_module_1.succeedNow, () => tsplus_module_2.fail(e, __tsplusTrace)), __tsplusTrace);
}
/**
 * Fails with given error 'e' if value is `Right`.
 *
 * @tsplus static ets/Stream/Aspects leftOrFail
 */

export const leftOrFail = (e, __tsplusTrace) => self => leftOrFail_(self, e, __tsplusTrace);
//# sourceMappingURL=leftOrFail.mjs.map