const fileName_1 = "(@effect/core) _src/io/Schedule/operations/mapEffect.ts";
import * as tsplus_module_1 from "@tsplus/stdlib/data/Tuple/make";
import * as tsplus_module_2 from "@effect/core/io/Effect/operations/map";
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 maps the output of this schedule through the
 * specified effectful function.
 *
 * @tsplus fluent ets/Schedule mapEffect
 * @tsplus fluent ets/Schedule/WithState mapEffect
 */

export function mapEffect_(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.map_(f(out), out2 => tsplus_module_1.make(state, out2, decision), fileName_1 + ":17:65"), fileName_1 + ":17:15"));
}
/**
 * Returns a new schedule that maps the output of this schedule through the
 * specified effectful function.
 *
 * @tsplus static ets/Schedule/Aspects mapEffect
 */

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