// ets_tracing: off
import * as C from "../../Cause";
import { pipe } from "../../Function";
import * as O from "../../Option";
import * as T from "../_internal/effect";
import * as M from "../_internal/managed";
import { Stream } from "./definitions";
/**
 * Transforms the full causes of failures emitted by this stream.
 */

export function mapErrorCause_(self, f) {
  return new Stream(M.map_(self.proc, T.mapErrorCause(x => O.fold_(C.sequenceCauseOption(x), () => C.fail(O.none), c => C.map(O.some)(f(c))))));
}
/**
 * Transforms the full causes of failures emitted by this stream.
 */

export function mapErrorCause(f) {
  return self => mapErrorCause_(self, f);
}
//# sourceMappingURL=mapErrorCause.js.map