const fileName_1 = "(@effect/core) _src/io/Schedule/operations/onDecision.ts";
import * as tsplus_module_1 from "@tsplus/stdlib/data/Tuple/make";
import * as tsplus_module_2 from "@effect/core/io/Effect/operations/as";
import * as tsplus_module_3 from "@effect/core/io/Effect/operations/flatMap";
import { makeWithState } from "@effect/core/io/Schedule/operations/_internal/makeWithState";
/**
 * Returns a new schedule that applies the current one but runs the specified
 * effect for every decision of this schedule. This can be used to create
 * schedules that log failures, decisions, or computed values.
 *
 * @tsplus fluent ets/Schedule onDecision
 * @tsplus fluent ets/Schedule/WithState onDecision
 */

export function onDecision_(self, f) {
  return makeWithState(self._initial, (now, input, state) => tsplus_module_3.flatMap_(self._step(now, input, state), ({
    tuple: [state, out, decision]
  }) => tsplus_module_2.as_(f(state, out, decision), () => tsplus_module_1.make(state, out, decision), fileName_1 + ":19:81"), fileName_1 + ":19:15"));
}
/**
 * Returns a new schedule that applies the current one but runs the specified
 * effect for every decision of this schedule. This can be used to create
 * schedules that log failures, decisions, or computed values.
 *
 * @tsplus static ets/Schedule/Aspects onDecision
 */

export const onDecision = f => self => onDecision_(self, f);
//# sourceMappingURL=onDecision.mjs.map