import * as tsplus_module_1 from "@effect/core/io/Effect/operations/asSome";
import * as tsplus_module_2 from "@effect/core/io/Effect/operations/succeedNone";
import * as tsplus_module_3 from "@effect/core/io/Effect/operations/suspendSucceed";
import * as tsplus_module_4 from "@effect/core/io/Effect/operations/flatMap";
/**
 * The moral equivalent of `if (p) exp` when `p` has side-effects.
 *
 * @tsplus static ets/Effect/Ops whenEffect
 */

export function whenEffect(predicate, effect, __tsplusTrace) {
  return tsplus_module_4.flatMap_(tsplus_module_3.suspendSucceed(predicate, __tsplusTrace), b => b ? tsplus_module_1.asSome(effect(), __tsplusTrace) : tsplus_module_2.succeedNone, __tsplusTrace);
}
//# sourceMappingURL=whenEffect.mjs.map