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/succeed";
import * as tsplus_module_4 from "@tsplus/stdlib/data/Either/fold";
import * as tsplus_module_5 from "@effect/core/io/Effect/operations/mapError";
import * as tsplus_module_6 from "@effect/core/io/Effect/operations/flatMap";
import * as tsplus_module_7 from "@effect/core/stream/Channel/operations/toPull";
import * as tsplus_module_8 from "@effect/core/io/Effect/operations/map";
import { concreteStream } from "@effect/core/stream/Stream/operations/_internal/StreamInternal";
/**
 * @tsplus fluent ets/Stream toPull
 */

export function toPull(self, __tsplusTrace) {
  void 0;
  return tsplus_module_8.map_(tsplus_module_7.toPull(self.channel), pull => tsplus_module_6.flatMap_(tsplus_module_5.mapError_(pull, tsplus_module_1.some, __tsplusTrace), either => tsplus_module_4.fold_(either, () => tsplus_module_2.fail(() => tsplus_module_1.none, __tsplusTrace), elem => tsplus_module_3.succeed(() => elem, __tsplusTrace)), __tsplusTrace), __tsplusTrace);
}
//# sourceMappingURL=toPull.mjs.map