import * as tsplus_module_1 from "@effect/core/io/Layer/operations/fail";
import * as tsplus_module_2 from "@effect/core/io/Layer/operations/foldLayer";
/**
 * Constructs a layer dynamically based on the output of this layer.
 *
 * @tsplus fluent ets/Layer flatMap
 */

export function flatMap_(self, f) {
  return tsplus_module_2.foldLayer_(self, e => tsplus_module_1.fail(() => e), f);
}
/**
 * Constructs a layer dynamically based on the output of this layer.
 *
 * @tsplus static ets/Layer/Aspects flatMap
 */

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