import * as tsplus_module_1 from "@tsplus/stdlib/data/Maybe/definition";
import * as tsplus_module_2 from "@effect/core/io/Effect/operations/fail";
import * as tsplus_module_3 from "@effect/core/io/Effect/operations/succeedNow";
import * as tsplus_module_4 from "@tsplus/stdlib/data/Maybe/fold";
import * as tsplus_module_5 from "@effect/core/io/Effect/operations/succeed";
import * as tsplus_module_6 from "@effect/core/io/Effect/operations/flatMap";
/**
 * Lifts an `Maybe` into an `Effect` but preserves the error as an option in
 * the error channel, making it easier to compose in some scenarios.
 *
 * @tsplus static ets/Effect/Ops fromMaybe
 */

export function fromMaybe(option, __tsplusTrace) {
  return tsplus_module_6.flatMap_(tsplus_module_5.succeed(option, __tsplusTrace), option => tsplus_module_4.fold_(option, () => tsplus_module_2.fail(() => tsplus_module_1.none, __tsplusTrace), tsplus_module_3.succeedNow), __tsplusTrace);
}
//# sourceMappingURL=fromMaybe.mjs.map