import * as tsplus_module_1 from "@effect/core/io/Effect/operations/succeedNone";
import * as tsplus_module_2 from "@tsplus/stdlib/data/Maybe/definition";
import * as tsplus_module_3 from "@effect/core/io/Effect/operations/map";
import * as tsplus_module_4 from "@tsplus/stdlib/data/Maybe/fold";
/**
 * Applies the function `f` if the argument is non-empty and returns the
 * results in a new `Maybe<B>`.
 *
 * @tsplus static ets/Effect/Ops forEachMaybe
 */

export function forEachMaybe(option, f, __tsplusTrace) {
  return tsplus_module_4.fold_(option, () => tsplus_module_1.succeedNone, a => tsplus_module_3.map_(f(a), tsplus_module_2.some, __tsplusTrace));
}
//# sourceMappingURL=forEachMaybe.mjs.map