// ets_tracing: off import { asUnit } from "./asUnit.js" import { chain_, unit } from "./core.js" import type { Effect } from "./effect.js" /** * The moral equivalent of `if (p) exp` when `p` has side-effects */ export function whenM_( self: Effect, predicate: Effect, __trace?: string ) { return chain_(predicate, (a) => (a ? asUnit(self, __trace) : unit)) } /** * The moral equivalent of `if (p) exp` when `p` has side-effects * * @ets_data_first whenM_ */ export function whenM(predicate: Effect, __trace?: string) { return (self: Effect) => whenM_(self, predicate, __trace) }