import * as tsplus_module_1 from "@tsplus/stdlib/data/Maybe/definition";
import * as tsplus_module_2 from "@effect/core/stm/STM/operations/map";
import * as tsplus_module_3 from "@effect/core/stm/STM/operations/succeedNow";
import * as tsplus_module_4 from "@effect/core/stm/STM/operations/suspend";
/**
 * The moral equivalent of `if (p) exp`.
 *
 * @tsplus static ets/STM/Ops when
 */

export function when(predicate, effect) {
  return tsplus_module_4.suspend(() => predicate() ? tsplus_module_2.map_(effect, tsplus_module_1.some) : tsplus_module_3.succeedNow(tsplus_module_1.none));
}
//# sourceMappingURL=when.mjs.map