const fileName_1 = "(@effect/core) _src/io/Schedule/operations/checkEffect.ts";
import * as tsplus_module_1 from "@effect/core/io/Schedule/Decision";
import * as tsplus_module_2 from "@tsplus/stdlib/data/Tuple/make";
import * as tsplus_module_3 from "@effect/core/io/Effect/operations/succeedNow";
import * as tsplus_module_4 from "@effect/core/io/Effect/operations/map";
import * as tsplus_module_5 from "@effect/core/io/Effect/operations/flatMap";
import { makeWithState } from "@effect/core/io/Schedule/operations/_internal/makeWithState";
/**
 * Returns a new schedule that passes each input and output of this schedule
 * to the specified function, and then determines whether or not to continue
 * based on the return value of the function.
 *
 * @tsplus fluent ets/Schedule checkEffect
 * @tsplus fluent ets/Schedule/WithState checkEffect
 */

export function checkEffect_(self, test) {
  return makeWithState(self._initial, (now, input, state) => tsplus_module_5.flatMap_(self._step(now, input, state), ({
    tuple: [state, out, decision]
  }) => decision._tag === "Done" ? tsplus_module_3.succeedNow(tsplus_module_2.make(state, out, tsplus_module_1.done), fileName_1 + ":21:30") : tsplus_module_4.map_(test(input, out), b => b ? tsplus_module_2.make(state, out, tsplus_module_1._continue(decision.interval)) : tsplus_module_2.make(state, out, tsplus_module_1.done), fileName_1 + ":22:33"), fileName_1 + ":19:15"));
}
/**
 * Returns a new schedule that passes each input and output of this schedule
 * to the specified function, and then determines whether or not to continue
 * based on the return value of the function.
 *
 * @tsplus static ets/Schedule/Aspects checkEffect
 */

export const checkEffect = test => self => checkEffect_(self, test);
//# sourceMappingURL=checkEffect.mjs.map