/** * The moral equivalent of `if (p) exp` when `p` has side-effects. * * @tsplus static effect/core/io/Effect.Ops whenEffect */ export function whenEffect( predicate: Effect, effect: Effect ): Effect> { return Effect.suspendSucceed(predicate).flatMap((b) => b ? effect.asSome : Effect.none) }