import * as tsplus_module_1 from "@effect/core/io/Effect/operations/fail";
import * as tsplus_module_2 from "@effect/core/io/Effect/operations/succeedNow";
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 `Left`.
 *
 * @tsplus fluent ets/Stream rightOrFail
 */

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

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