// tracing: off
import * as O from "../../Option"
import { catchAll_ } from "./catchAll"
import { fail } from "./fail"
/**
 * Switches to the provided stream in case this one fails with the `None` value.
 *
 * See also `Stream#catchAll`.
 */

export function orElseOptional_(self, that) {
  return catchAll_(
    self,
    O.fold(
      () => that,
      (e) => fail(O.some(e))
    )
  )
}
/**
 * Switches to the provided stream in case this one fails with the `None` value.
 *
 * See also `Stream#catchAll`.
 */

export function orElseOptional(that) {
  return (self) => orElseOptional_(self, that)
}
//# sourceMappingURL=orElseOptional.js.map
