import * as tsplus_module_1 from "@effect/core/stream/Channel/operations/unit";
import * as tsplus_module_2 from "@effect/core/stream/Channel/operations/fail";
import * as tsplus_module_3 from "@tsplus/stdlib/data/Maybe/fold";
import * as tsplus_module_4 from "@tsplus/stdlib/collections/Chunk/single";
import * as tsplus_module_5 from "@effect/core/stream/Channel/operations/write";
import * as tsplus_module_6 from "@effect/core/io/Effect/operations/fold";
import * as tsplus_module_7 from "@effect/core/stream/Channel/operations/unwrap";
import { StreamInternal } from "@effect/core/stream/Stream/operations/_internal/StreamInternal";
/**
 * Creates a stream from an effect producing a value of type `A` or an empty
 * `Stream`.
 *
 * @tsplus static ets/Stream/Ops fromEffectMaybe
 */

export function fromEffectMaybe(effect, __tsplusTrace) {
  return new StreamInternal(tsplus_module_7.unwrap(() => tsplus_module_6.fold_(effect(), option => tsplus_module_3.fold_(option, () => tsplus_module_1.unit, e => tsplus_module_2.fail(() => e)), a => tsplus_module_5.write(() => tsplus_module_4.single(a)), __tsplusTrace)));
}
//# sourceMappingURL=fromEffectMaybe.mjs.map