import * as tsplus_module_1 from "@effect/core/stm/STM/operations/succeedNow";
import * as tsplus_module_2 from "@effect/core/stm/STM/operations/suspend";
import * as tsplus_module_3 from "@effect/core/stm/STM/operations/flatMap";
export const filterOrElseWith_ = filterOrElseWith_1;

function filterOrElseWith_1(self, f, orElse) {
  return tsplus_module_3.flatMap_(self, a => f(a) ? tsplus_module_1.succeedNow(a) : tsplus_module_2.suspend(() => orElse(a)));
}

export function filterOrElseWith(f, orElse) {
  return self => filterOrElseWith_1(self, f, orElse);
}
//# sourceMappingURL=filterOrElseWith.mjs.map