Trait/Object

zio

ZIO

Related Docs: object ZIO | package zio

Permalink

sealed trait ZIO[-R, +E, +A] extends Serializable with ZIOPlatformSpecific[R, E, A] with ZIOVersionSpecific[R, E, A]

A ZIO[R, E, A] value is an immutable value that lazily describes a workflow or job. The workflow requires some environment R, and may fail with an error of type E, or succeed with a value of type A.

These lazy workflows, referred to as _effects_, can be informally thought of as functions in the form:

R => Either[E, A]

ZIO effects model resourceful interaction with the outside world, including synchronous, asynchronous, concurrent, and parallel interaction.

ZIO effects use a fiber-based concurrency model, with built-in support for scheduling, fine-grained interruption, structured concurrency, and high scalability.

To run an effect, you need a Runtime, which is capable of executing effects. Runtimes bundle a thread pool together with the environment that effects need.

Self Type
ZIO[R, E, A]
Linear Supertypes
ZIOVersionSpecific[R, E, A], ZIOPlatformSpecific[R, E, A], Serializable, Serializable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ZIO
  2. ZIOVersionSpecific
  3. ZIOPlatformSpecific
  4. Serializable
  5. Serializable
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def tag: Int

    Permalink

    An integer that identifies the term in the ZIO sum type to which this instance belongs (e.g.

    An integer that identifies the term in the ZIO sum type to which this instance belongs (e.g. IO.Tags.Succeed).

Concrete Value Members

  1. final def !(implicit ev1: <:<[E, Throwable], ev2: CanFail[E], trace: ZTraceElement): ZIO[R, Nothing, A]

    Permalink

    A symbolic alias for orDie.

  2. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def &&[R1 <: R, E1 >: E](that: ⇒ ZIO[R1, E1, Boolean])(implicit ev: <:<[A, Boolean], trace: ZTraceElement): ZIO[R1, E1, Boolean]

    Permalink

    Returns the logical conjunction of the Boolean value returned by this effect and the Boolean value returned by the specified effect.

    Returns the logical conjunction of the Boolean value returned by this effect and the Boolean value returned by the specified effect. This operator has "short circuiting" behavior so if the value returned by this effect is false the specified effect will not be evaluated.

  5. final def &>[R1 <: R, E1 >: E, B](that: ⇒ ZIO[R1, E1, B])(implicit trace: ZTraceElement): ZIO[R1, E1, B]

    Permalink

    Returns an effect that executes both this effect and the specified effect, in parallel, returning result of provided effect.

    Returns an effect that executes both this effect and the specified effect, in parallel, returning result of provided effect. If either side fails, then the other side will be interrupted.

  6. final def *>[R1 <: R, E1 >: E, B](that: ⇒ ZIO[R1, E1, B])(implicit trace: ZTraceElement): ZIO[R1, E1, B]

    Permalink

    A variant of flatMap that ignores the value produced by this effect.

  7. final def <&[R1 <: R, E1 >: E, B](that: ⇒ ZIO[R1, E1, B])(implicit trace: ZTraceElement): ZIO[R1, E1, A]

    Permalink

    Returns an effect that executes both this effect and the specified effect, in parallel, this effect result returned.

    Returns an effect that executes both this effect and the specified effect, in parallel, this effect result returned. If either side fails, then the other side will be interrupted.

  8. final def <&>[R1 <: R, E1 >: E, B](that: ⇒ ZIO[R1, E1, B])(implicit zippable: Zippable[A, B], trace: ZTraceElement): ZIO[R1, E1, Out]

    Permalink

    Returns an effect that executes both this effect and the specified effect, in parallel, combining their results into a tuple.

    Returns an effect that executes both this effect and the specified effect, in parallel, combining their results into a tuple. If either side fails, then the other side will be interrupted.

  9. final def <*[R1 <: R, E1 >: E, B](that: ⇒ ZIO[R1, E1, B])(implicit trace: ZTraceElement): ZIO[R1, E1, A]

    Permalink

    Sequences the specified effect after this effect, but ignores the value produced by the effect.

  10. final def <*>[R1 <: R, E1 >: E, B](that: ⇒ ZIO[R1, E1, B])(implicit zippable: Zippable[A, B], trace: ZTraceElement): ZIO[R1, E1, Out]

    Permalink

    Sequentially zips this effect with the specified effect, combining the results into a tuple.

  11. final def <+>[R1 <: R, E1, B](that: ⇒ ZIO[R1, E1, B])(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R1, E1, Either[A, B]]

    Permalink

    A symbolic alias for orElseEither.

  12. final def <>[R1 <: R, E2, A1 >: A](that: ⇒ ZIO[R1, E2, A1])(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R1, E2, A1]

    Permalink

    Operator alias for orElse.

  13. final def <|>[R1 <: R, E1 >: E, B](that: ⇒ ZIO[R1, E1, B])(implicit trace: ZTraceElement): ZIO[R1, E1, Either[A, B]]

    Permalink

    A symbolic alias for raceEither.

  14. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  15. final def @@[LowerR <: UpperR, UpperR <: R, LowerE >: E, UpperE >: LowerE, LowerA >: A, UpperA >: LowerA](aspect: ⇒ ZIOAspect[LowerR, UpperR, LowerE, UpperE, LowerA, UpperA])(implicit trace: ZTraceElement): ZIO[UpperR, LowerE, LowerA]

    Permalink

    Syntax for adding aspects.

  16. final def absolve[E1 >: E, B](implicit ev: IsSubtypeOfOutput[A, Either[E1, B]], trace: ZTraceElement): ZIO[R, E1, B]

    Permalink

    Returns an effect that submerges the error case of an Either into the ZIO.

    Returns an effect that submerges the error case of an Either into the ZIO. The inverse operation of ZIO.either.

  17. final def absorb(implicit ev: IsSubtypeOfError[E, Throwable], trace: ZTraceElement): RIO[R, A]

    Permalink

    Attempts to convert defects into a failure, throwing away all information about the cause of the failure.

  18. final def absorbWith(f: (E) ⇒ Throwable)(implicit trace: ZTraceElement): RIO[R, A]

    Permalink

    Attempts to convert defects into a failure, throwing away all information about the cause of the failure.

  19. final def acquireRelease[R1 <: R, E1 >: E, B](release: ⇒ URIO[R1, Any], use: ⇒ ZIO[R1, E1, B])(implicit trace: ZTraceElement): ZIO[R1, E1, B]

    Permalink

    Uncurried version.

    Uncurried version. Doesn't offer curried syntax and has worse type-inference characteristics, but it doesn't allocate intermediate zio.ZIO.AcquireDiscard and zio.ZIO.ReleaseDiscard objects.

  20. final def acquireRelease[R1 <: R, E1 >: E]: AcquireDiscard[R1, E1]

    Permalink

    A less powerful variant of acquireReleaseWith where the resource acquired by this effect is not needed.

  21. final def acquireReleaseExitWith: AcquireExit[R, E, A]

    Permalink

    Shorthand for the curried version of ZIO.acquireReleaseExitWith.

  22. final def acquireReleaseExitWith[R1 <: R, E1 >: E, B](release: (A, Exit[E1, B]) ⇒ URIO[R1, Any], use: (A) ⇒ ZIO[R1, E1, B])(implicit trace: ZTraceElement): ZIO[R1, E1, B]

    Permalink

    Shorthand for the uncurried version of ZIO.acquireReleaseExitWith.

  23. final def acquireReleaseOnErrorWith[R1 <: R, E1 >: E, B](release: (A) ⇒ URIO[R1, Any])(use: (A) ⇒ ZIO[R1, E1, B])(implicit trace: ZTraceElement): ZIO[R1, E1, B]

    Permalink

    Executes the release effect only if there was an error.

  24. final def acquireReleaseWith: Acquire[R, E, A]

    Permalink

    Shorthand for the curried version of ZIO.acquireReleaseWith.

  25. final def acquireReleaseWith[R1 <: R, E1 >: E, B](release: (A) ⇒ URIO[R1, Any], use: (A) ⇒ ZIO[R1, E1, B])(implicit trace: ZTraceElement): ZIO[R1, E1, B]

    Permalink

    Shorthand for the uncurried version of ZIO.acquireReleaseWith.

  26. final def as[B](b: ⇒ B)(implicit trace: ZTraceElement): ZIO[R, E, B]

    Permalink

    Maps the success value of this effect to the specified constant value.

  27. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  28. final def asLeft(implicit trace: ZTraceElement): ZIO[R, E, Either[A, Nothing]]

    Permalink

    Maps the success value of this effect to a left value.

  29. final def asLeftError(implicit trace: ZTraceElement): ZIO[R, Either[E, Nothing], A]

    Permalink

    Maps the error value of this effect to a left value.

  30. final def asRight(implicit trace: ZTraceElement): ZIO[R, E, Either[Nothing, A]]

    Permalink

    Maps the success value of this effect to a right value.

  31. final def asRightError(implicit trace: ZTraceElement): ZIO[R, Either[Nothing, E], A]

    Permalink

    Maps the error value of this effect to a right value.

  32. final def asSome(implicit trace: ZTraceElement): ZIO[R, E, Option[A]]

    Permalink

    Maps the success value of this effect to an optional value.

  33. final def asSomeError(implicit trace: ZTraceElement): ZIO[R, Option[E], A]

    Permalink

    Maps the error value of this effect to an optional value.

  34. final def awaitAllChildren(implicit trace: ZTraceElement): ZIO[R, E, A]

    Permalink

    Returns a new effect that will not succeed with its value before first waiting for the end of all child fibers forked by the effect.

  35. final def cached(timeToLive: ⇒ zio.Duration)(implicit trace: ZTraceElement): ZIO[R with Clock, Nothing, IO[E, A]]

    Permalink

    Returns an effect that, if evaluated, will return the cached result of this effect.

    Returns an effect that, if evaluated, will return the cached result of this effect. Cached results will expire after timeToLive duration.

  36. final def cachedInvalidate(timeToLive0: ⇒ zio.Duration)(implicit trace: ZTraceElement): ZIO[R with Clock, Nothing, (IO[E, A], UIO[Unit])]

    Permalink

    Returns an effect that, if evaluated, will return the cached result of this effect.

    Returns an effect that, if evaluated, will return the cached result of this effect. Cached results will expire after timeToLive duration. In addition, returns an effect that can be used to invalidate the current cached value before the timeToLive duration expires.

  37. final def catchAll[R1 <: R, E2, A1 >: A](h: (E) ⇒ ZIO[R1, E2, A1])(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R1, E2, A1]

    Permalink

    Recovers from all errors.

    Recovers from all errors.

    openFile("config.json").catchAll(_ => IO.succeed(defaultConfig))
  38. final def catchAllCause[R1 <: R, E2, A1 >: A](h: (Cause[E]) ⇒ ZIO[R1, E2, A1])(implicit trace: ZTraceElement): ZIO[R1, E2, A1]

    Permalink

    Recovers from all errors with provided Cause.

    Recovers from all errors with provided Cause.

    openFile("config.json").catchAllCause(_ => IO.succeed(defaultConfig))
    See also

    absorb, sandbox, mapErrorCause - other functions that can recover from defects

  39. final def catchAllDefect[R1 <: R, E1 >: E, A1 >: A](h: (Throwable) ⇒ ZIO[R1, E1, A1])(implicit trace: ZTraceElement): ZIO[R1, E1, A1]

    Permalink

    Recovers from all defects with provided function.

    Recovers from all defects with provided function.

    effect.catchSomeDefect(_ => backup())

    WARNING: There is no sensible way to recover from defects. This method should be used only at the boundary between ZIO and an external system, to transmit information on a defect for diagnostic or explanatory purposes.

  40. final def catchAllTrace[R1 <: R, E2, A1 >: A](h: ((E, ZTrace)) ⇒ ZIO[R1, E2, A1])(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R1, E2, A1]

    Permalink

    A version of catchAll that gives you the (optional) trace of the error.

  41. final def catchNonFatalOrDie[R1 <: R, E2, A1 >: A](h: (E) ⇒ ZIO[R1, E2, A1])(implicit ev1: CanFail[E], ev2: <:<[E, Throwable], trace: ZTraceElement): ZIO[R1, E2, A1]

    Permalink

    Recovers from all NonFatal Throwables.

    Recovers from all NonFatal Throwables.

    openFile("data.json").catchNonFatalOrDie(_ => openFile("backup.json"))
  42. final def catchSome[R1 <: R, E1 >: E, A1 >: A](pf: PartialFunction[E, ZIO[R1, E1, A1]])(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R1, E1, A1]

    Permalink

    Recovers from some or all of the error cases.

    Recovers from some or all of the error cases.

    openFile("data.json").catchSome {
      case _: FileNotFoundException => openFile("backup.json")
    }
  43. final def catchSomeCause[R1 <: R, E1 >: E, A1 >: A](pf: PartialFunction[Cause[E], ZIO[R1, E1, A1]])(implicit trace: ZTraceElement): ZIO[R1, E1, A1]

    Permalink

    Recovers from some or all of the error cases with provided cause.

    Recovers from some or all of the error cases with provided cause.

    openFile("data.json").catchSomeCause {
      case c if (c.interrupted) => openFile("backup.json")
    }
  44. final def catchSomeDefect[R1 <: R, E1 >: E, A1 >: A](pf: PartialFunction[Throwable, ZIO[R1, E1, A1]])(implicit trace: ZTraceElement): ZIO[R1, E1, A1]

    Permalink

    Recovers from some or all of the defects with provided partial function.

    Recovers from some or all of the defects with provided partial function.

    effect.catchSomeDefect {
      case _: SecurityException => backup()
    }

    WARNING: There is no sensible way to recover from defects. This method should be used only at the boundary between ZIO and an external system, to transmit information on a defect for diagnostic or explanatory purposes.

  45. final def catchSomeTrace[R1 <: R, E1 >: E, A1 >: A](pf: PartialFunction[(E, ZTrace), ZIO[R1, E1, A1]])(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R1, E1, A1]

    Permalink

    A version of catchSome that gives you the trace of the error.

  46. final def cause(implicit trace: ZTraceElement): URIO[R, Cause[E]]

    Permalink

    Returns an effect that succeeds with the cause of failure of this effect, or Cause.empty if the effect did succeed.

  47. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  48. final def collect[E1 >: E, B](e: ⇒ E1)(pf: PartialFunction[A, B])(implicit trace: ZTraceElement): ZIO[R, E1, B]

    Permalink

    Fail with e if the supplied PartialFunction does not match, otherwise succeed with the returned value.

  49. final def collectZIO[R1 <: R, E1 >: E, B](e: ⇒ E1)(pf: PartialFunction[A, ZIO[R1, E1, B]])(implicit trace: ZTraceElement): ZIO[R1, E1, B]

    Permalink

    Fail with e if the supplied PartialFunction does not match, otherwise continue with the returned value.

  50. final def debug(prefix: ⇒ String)(implicit trace: ZTraceElement): ZIO[R, E, A]

    Permalink

    Taps the effect, printing the result of calling .toString on the value.

    Taps the effect, printing the result of calling .toString on the value. Prefixes the output with the given message.

  51. final def debug(implicit trace: ZTraceElement): ZIO[R, E, A]

    Permalink

    Taps the effect, printing the result of calling .toString on the value

  52. final def delay(duration: ⇒ zio.Duration)(implicit trace: ZTraceElement): ZIO[R with Clock, E, A]

    Permalink

    Returns an effect that is delayed from this effect by the specified zio.Duration.

  53. final def disconnect(implicit trace: ZTraceElement): ZIO[R, E, A]

    Permalink

    Returns an effect whose interruption will be disconnected from the fiber's own interruption, being performed in the background without slowing down the fiber's interruption.

    Returns an effect whose interruption will be disconnected from the fiber's own interruption, being performed in the background without slowing down the fiber's interruption.

    This method is useful to create "fast interrupting" effects. For example, if you call this on an acquire release effect, then even if the effect is "stuck" in acquire or release, its interruption will return immediately, while the acquire / release are performed in the background.

    See timeout and race for other applications.

  54. final def either(implicit ev: CanFail[E], trace: ZTraceElement): URIO[R, Either[E, A]]

    Permalink

    Returns an effect whose failure and success have been lifted into an Either.The resulting effect cannot fail, because the failure case has been exposed as part of the Either success case.

    Returns an effect whose failure and success have been lifted into an Either.The resulting effect cannot fail, because the failure case has been exposed as part of the Either success case.

    This method is useful for recovering from ZIO effects that may fail.

    The error parameter of the returned ZIO is Nothing, since it is guaranteed the ZIO effect does not model failure.

  55. final def ensuring[R1 <: R](finalizer: ⇒ URIO[R1, Any])(implicit trace: ZTraceElement): ZIO[R1, E, A]

    Permalink

    Returns an effect that, if this effect _starts_ execution, then the specified finalizer is guaranteed to begin execution, whether this effect succeeds, fails, or is interrupted.

    Returns an effect that, if this effect _starts_ execution, then the specified finalizer is guaranteed to begin execution, whether this effect succeeds, fails, or is interrupted.

    For use cases that need access to the effect's result, see ZIO#onExit.

    Finalizers offer very powerful guarantees, but they are low-level, and should generally not be used for releasing resources. For higher-level logic built on ensuring, see ZIO#acquireReleaseWith.

  56. final def ensuringChild[R1 <: R](f: (Fiber[Any, Iterable[Any]]) ⇒ ZIO[R1, Nothing, Any])(implicit trace: ZTraceElement): ZIO[R1, E, A]

    Permalink

    Acts on the children of this fiber (collected into a single fiber), guaranteeing the specified callback will be invoked, whether or not this effect succeeds.

  57. def ensuringChildren[R1 <: R](children: (Chunk[Fiber.Runtime[Any, Any]]) ⇒ ZIO[R1, Nothing, Any])(implicit trace: ZTraceElement): ZIO[R1, E, A]

    Permalink

    Acts on the children of this fiber, guaranteeing the specified callback will be invoked, whether or not this effect succeeds.

  58. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  59. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  60. final def eventually(implicit ev: CanFail[E], trace: ZTraceElement): URIO[R, A]

    Permalink

    Returns an effect that ignores errors and runs repeatedly until it eventually succeeds.

  61. final def exit(implicit trace: ZTraceElement): URIO[R, Exit[E, A]]

    Permalink

    Returns an effect that semantically runs the effect on a fiber, producing an zio.Exit for the completion value of the fiber.

  62. final def exitCode(implicit trace: ZTraceElement): URIO[R, ExitCode]

    Permalink

    Maps this effect to the default exit codes.

  63. final def filterOrDie(p: (A) ⇒ Boolean)(t: ⇒ Throwable)(implicit trace: ZTraceElement): ZIO[R, E, A]

    Permalink

    Dies with specified Throwable if the predicate fails.

  64. final def filterOrDieMessage(p: (A) ⇒ Boolean)(message: ⇒ String)(implicit trace: ZTraceElement): ZIO[R, E, A]

    Permalink

    Dies with a java.lang.RuntimeException having the specified text message if the predicate fails.

  65. final def filterOrElse[R1 <: R, E1 >: E, A1 >: A](p: (A) ⇒ Boolean)(zio: ⇒ ZIO[R1, E1, A1])(implicit trace: ZTraceElement): ZIO[R1, E1, A1]

    Permalink

    Supplies zio if the predicate fails.

  66. final def filterOrElseWith[R1 <: R, E1 >: E, A1 >: A](p: (A) ⇒ Boolean)(f: (A) ⇒ ZIO[R1, E1, A1])(implicit trace: ZTraceElement): ZIO[R1, E1, A1]

    Permalink

    Applies f if the predicate fails.

  67. final def filterOrFail[E1 >: E](p: (A) ⇒ Boolean)(e: ⇒ E1)(implicit trace: ZTraceElement): ZIO[R, E1, A]

    Permalink

    Fails with e if the predicate fails.

  68. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  69. final def firstSuccessOf[R1 <: R, E1 >: E, A1 >: A](rest: ⇒ Iterable[ZIO[R1, E1, A1]])(implicit trace: ZTraceElement): ZIO[R1, E1, A1]

    Permalink

    Returns an effect that runs this effect and in case of failure, runs each of the specified effects in order until one of them succeeds.

  70. def flatMap[R1 <: R, E1 >: E, B](k: (A) ⇒ ZIO[R1, E1, B])(implicit trace: ZTraceElement): ZIO[R1, E1, B]

    Permalink

    Returns an effect that models the execution of this effect, followed by the passing of its value to the specified continuation function k, followed by the effect that it returns.

    Returns an effect that models the execution of this effect, followed by the passing of its value to the specified continuation function k, followed by the effect that it returns.

    val parsed = readFile("foo.txt").flatMap(file => parseFile(file))
  71. final def flatMapError[R1 <: R, E2](f: (E) ⇒ URIO[R1, E2])(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R1, E2, A]

    Permalink

    Creates a composite effect that represents this effect followed by another one that may depend on the error produced by this one.

    Creates a composite effect that represents this effect followed by another one that may depend on the error produced by this one.

    val parsed = readFile("foo.txt").flatMapError(error => logErrorToFile(error))
  72. final def flatten[R1 <: R, E1 >: E, B](implicit ev1: IsSubtypeOfOutput[A, ZIO[R1, E1, B]], trace: ZTraceElement): ZIO[R1, E1, B]

    Permalink

    Returns an effect that performs the outer effect first, followed by the inner effect, yielding the value of the inner effect.

    Returns an effect that performs the outer effect first, followed by the inner effect, yielding the value of the inner effect.

    This method can be used to "flatten" nested effects.

  73. final def flattenErrorOption[E1, E2 <: E1](default: ⇒ E2)(implicit ev: IsSubtypeOfError[E, Option[E1]], trace: ZTraceElement): ZIO[R, E1, A]

    Permalink

    Unwraps the optional error, defaulting to the provided value.

  74. final def flip(implicit trace: ZTraceElement): ZIO[R, A, E]

    Permalink

    Returns an effect that swaps the error/success cases.

    Returns an effect that swaps the error/success cases. This allows you to use all methods on the error channel, possibly before flipping back.

  75. final def flipWith[R1, A1, E1](f: (ZIO[R, A, E]) ⇒ ZIO[R1, A1, E1])(implicit trace: ZTraceElement): ZIO[R1, E1, A1]

    Permalink

    Swaps the error/value parameters, applies the function f and flips the parameters back

  76. final def fold[B](failure: (E) ⇒ B, success: (A) ⇒ B)(implicit ev: CanFail[E], trace: ZTraceElement): URIO[R, B]

    Permalink

    Folds over the failure value or the success value to yield an effect that does not fail, but succeeds with the value returned by the left or right function passed to fold.

  77. final def foldCause[B](failure: (Cause[E]) ⇒ B, success: (A) ⇒ B)(implicit trace: ZTraceElement): URIO[R, B]

    Permalink

    A more powerful version of fold that allows recovering from any kind of failure except interruptions.

  78. final def foldCauseZIO[R1 <: R, E2, B](failure: (Cause[E]) ⇒ ZIO[R1, E2, B], success: (A) ⇒ ZIO[R1, E2, B])(implicit trace: ZTraceElement): ZIO[R1, E2, B]

    Permalink

    A more powerful version of foldZIO that allows recovering from any kind of failure except interruptions.

  79. final def foldTraceZIO[R1 <: R, E2, B](failure: ((E, ZTrace)) ⇒ ZIO[R1, E2, B], success: (A) ⇒ ZIO[R1, E2, B])(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R1, E2, B]

    Permalink

    A version of foldZIO that gives you the trace of the error.

  80. final def foldZIO[R1 <: R, E2, B](failure: (E) ⇒ ZIO[R1, E2, B], success: (A) ⇒ ZIO[R1, E2, B])(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R1, E2, B]

    Permalink

    Recovers from errors by accepting one effect to execute for the case of an error, and one effect to execute for the case of success.

    Recovers from errors by accepting one effect to execute for the case of an error, and one effect to execute for the case of success.

    This method has better performance than either since no intermediate value is allocated and does not require subsequent calls to flatMap to define the next effect.

    The error parameter of the returned IO may be chosen arbitrarily, since it will depend on the IOs returned by the given continuations.

  81. final def forEachZIO[R1 <: R, E2, B](f: (A) ⇒ ZIO[R1, E2, B])(implicit trace: ZTraceElement): ZIO[R1, E2, Option[B]]

    Permalink

    Returns a new effect that will pass the success value of this effect to the provided callback.

    Returns a new effect that will pass the success value of this effect to the provided callback. If this effect fails, then the failure will be ignored.

  82. final def forever(implicit trace: ZTraceElement): ZIO[R, E, Nothing]

    Permalink

    Repeats this effect forever (until the first error).

    Repeats this effect forever (until the first error). For more sophisticated schedules, see the repeat method.

  83. final def fork(implicit trace: ZTraceElement): URIO[R, Fiber.Runtime[E, A]]

    Permalink

    Returns an effect that forks this effect into its own separate fiber, returning the fiber immediately, without waiting for it to begin executing the effect.

    Returns an effect that forks this effect into its own separate fiber, returning the fiber immediately, without waiting for it to begin executing the effect.

    You can use the fork method whenever you want to execute an effect in a new fiber, concurrently and without "blocking" the fiber executing other effects. Using fibers can be tricky, so instead of using this method directly, consider other higher-level methods, such as raceWith, zipPar, and so forth.

    The fiber returned by this method has methods to interrupt the fiber and to wait for it to finish executing the effect. See zio.Fiber for more information.

    Whenever you use this method to launch a new fiber, the new fiber is attached to the parent fiber's scope. This means when the parent fiber terminates, the child fiber will be terminated as well, ensuring that no fibers leak. This behavior is called "auto supervision", and if this behavior is not desired, you may use the forkDaemon or forkIn methods.

    for {
      fiber <- subtask.fork
      // Do stuff...
      a <- fiber.join
    } yield a
  84. final def forkDaemon(implicit trace: ZTraceElement): URIO[R, Fiber.Runtime[E, A]]

    Permalink

    Forks the effect into a new fiber attached to the global scope.

    Forks the effect into a new fiber attached to the global scope. Because the new fiber is attached to the global scope, when the fiber executing the returned effect terminates, the forked fiber will continue running.

  85. final def forkIn(scope: ⇒ ZScope[Exit[Any, Any]])(implicit trace: ZTraceElement): URIO[R, Fiber.Runtime[E, A]]

    Permalink
  86. final def forkManaged(implicit trace: ZTraceElement): ZManaged[R, Nothing, Fiber.Runtime[E, A]]

    Permalink

    Forks the fiber in a ZManaged.

    Forks the fiber in a ZManaged. Using the ZManaged value will execute the effect in the fiber, while ensuring its interruption when the effect supplied to ZManaged#use completes.

  87. final def forkWithErrorHandler(handler: (E) ⇒ UIO[Any])(implicit trace: ZTraceElement): URIO[R, Fiber.Runtime[E, A]]

    Permalink

    Like fork but handles an error with the provided handler.

  88. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  89. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  90. final def head[B](implicit ev: IsSubtypeOfOutput[A, List[B]], trace: ZTraceElement): ZIO[R, Option[E], B]

    Permalink

    Returns a successful effect with the head of the list if the list is non-empty or fails with the error None if the list is empty.

  91. final def ignore(implicit trace: ZTraceElement): URIO[R, Unit]

    Permalink

    Returns a new effect that ignores the success or failure of this effect.

  92. final def in(scope: ⇒ ZScope[Any])(implicit trace: ZTraceElement): ZIO[R, E, A]

    Permalink

    Returns a new effect whose scope will be extended by the specified scope.

    Returns a new effect whose scope will be extended by the specified scope. This means any finalizers associated with the effect will not be executed until the specified scope is closed.

  93. macro def inject[E1 >: E](layer: ZLayer[_, E1, _]*): ZIO[Any, E1, A]

    Permalink

    Automatically assembles a layer for the ZIO effect.

    Automatically assembles a layer for the ZIO effect.

    Definition Classes
    ZIOVersionSpecific
  94. macro def injectCustom[E1 >: E](layer: ZLayer[_, E1, _]*): ZIO[ZEnv, E1, A]

    Permalink

    Automatically constructs the part of the environment that is not part of the ZEnv, leaving an effect that only depends on the ZEnv.

    Automatically constructs the part of the environment that is not part of the ZEnv, leaving an effect that only depends on the ZEnv. This will also satisfy transitive ZEnv requirements with ZEnv.any, allowing them to be provided later.

    val zio: ZIO[OldLady with Console, Nothing, Unit] = ???
    val oldLadyLayer: ZLayer[Fly, Nothing, OldLady] = ???
    val flyLayer: ZLayer[Blocking, Nothing, Fly] = ???
    
    // The ZEnv you use later will provide both Blocking to flyLayer and Console to zio
    val zio2 : ZIO[ZEnv, Nothing, Unit] = zio.injectCustom(oldLadyLayer, flyLayer)
    Definition Classes
    ZIOVersionSpecific
  95. def injectSome[R0]: ProvideSomePartiallyApplied[R0, R, E, A]

    Permalink

    Splits the environment into two parts, assembling one part using the specified layer and leaving the remainder R0.

    Splits the environment into two parts, assembling one part using the specified layer and leaving the remainder R0.

    val clockLayer: ZLayer[Any, Nothing, Clock] = ???
    
    val zio: ZIO[Clock with Random, Nothing, Unit] = ???
    
    val zio2 = zio.injectSome[Random](clockLayer)
    Definition Classes
    ZIOVersionSpecific
  96. final def interruptAllChildren(implicit trace: ZTraceElement): ZIO[R, E, A]

    Permalink

    Returns a new effect that will not succeed with its value before first interrupting all child fibers forked by the effect.

  97. final def interruptStatus(flag: ⇒ InterruptStatus)(implicit trace: ZTraceElement): ZIO[R, E, A]

    Permalink

    Switches the interrupt status for this effect.

    Switches the interrupt status for this effect. If true is used, then the effect becomes interruptible (the default), while if false is used, then the effect becomes uninterruptible. These changes are compositional, so they only affect regions of the effect.

  98. final def interruptible(implicit trace: ZTraceElement): ZIO[R, E, A]

    Permalink

    Returns a new effect that performs the same operations as this effect, but interruptibly, even if composed inside of an uninterruptible region.

    Returns a new effect that performs the same operations as this effect, but interruptibly, even if composed inside of an uninterruptible region.

    Note that effects are interruptible by default, so this function only has meaning if used within an uninterruptible region.

    WARNING: This operator "punches holes" into effects, allowing them to be interrupted in unexpected places. Do not use this operator unless you know exactly what you are doing. Instead, you should use ZIO.uninterruptibleMask.

  99. final def intoPromise[E1 >: E, A1 >: A](p: ⇒ Promise[E1, A1])(implicit trace: ZTraceElement): URIO[R, Boolean]

    Permalink

    Returns an effect that keeps or breaks a promise based on the result of this effect.

    Returns an effect that keeps or breaks a promise based on the result of this effect. Synchronizes interruption, so if this effect is interrupted, the specified promise will be interrupted, too.

  100. final def isFailure(implicit trace: ZTraceElement): URIO[R, Boolean]

    Permalink

    Returns whether this effect is a failure.

  101. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  102. final def isSuccess(implicit trace: ZTraceElement): URIO[R, Boolean]

    Permalink

    Returns whether this effect is a success.

  103. final def left[B, C](implicit ev: IsSubtypeOfOutput[A, Either[B, C]], trace: ZTraceElement): ZIO[R, Either[E, C], B]

    Permalink

    "Zooms in" on the value in the Left side of an Either, moving the possibility that the value is a Right to the error channel.

  104. def map[B](f: (A) ⇒ B)(implicit trace: ZTraceElement): ZIO[R, E, B]

    Permalink

    Returns an effect whose success is mapped by the specified f function.

  105. final def mapAttempt[B](f: (A) ⇒ B)(implicit ev: IsSubtypeOfError[E, Throwable], trace: ZTraceElement): RIO[R, B]

    Permalink

    Returns an effect whose success is mapped by the specified side effecting f function, translating any thrown exceptions into typed failed effects.

  106. final def mapBoth[E2, B](f: (E) ⇒ E2, g: (A) ⇒ B)(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R, E2, B]

    Permalink

    Returns an effect whose failure and success channels have been mapped by the specified pair of functions, f and g.

  107. final def mapError[E2](f: (E) ⇒ E2)(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R, E2, A]

    Permalink

    Returns an effect with its error channel mapped using the specified function.

    Returns an effect with its error channel mapped using the specified function. This can be used to lift a "smaller" error into a "larger" error.

  108. final def mapErrorCause[E2](h: (Cause[E]) ⇒ Cause[E2])(implicit trace: ZTraceElement): ZIO[R, E2, A]

    Permalink

    Returns an effect with its full cause of failure mapped using the specified function.

    Returns an effect with its full cause of failure mapped using the specified function. This can be used to transform errors while preserving the original structure of Cause.

    See also

    absorb, sandbox, catchAllCause - other functions for dealing with defects

  109. final def memoize(implicit trace: ZTraceElement): UIO[ZIO[R, E, A]]

    Permalink

    Returns an effect that, if evaluated, will return the lazily computed result of this effect.

  110. final def merge[A1 >: A](implicit ev1: IsSubtypeOfError[E, A1], ev2: CanFail[E], trace: ZTraceElement): URIO[R, A1]

    Permalink

    Returns a new effect where the error channel has been merged into the success channel to their common combined type.

  111. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  112. final def negate(implicit ev: IsSubtypeOfOutput[A, Boolean], trace: ZTraceElement): ZIO[R, E, Boolean]

    Permalink

    Returns a new effect where boolean value of this effect is negated.

  113. final def none[B](implicit ev: IsSubtypeOfOutput[A, Option[B]], trace: ZTraceElement): ZIO[R, Option[E], Unit]

    Permalink

    Requires the option produced by this value to be None.

  114. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  115. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  116. final def onDone[R1 <: R](error: (E) ⇒ ZIO[R1, Nothing, Any], success: (A) ⇒ ZIO[R1, Nothing, Any])(implicit trace: ZTraceElement): ZIO[R1, Nothing, Unit]

    Permalink
  117. final def onDoneCause[R1 <: R](error: (Cause[E]) ⇒ ZIO[R1, Nothing, Any], success: (A) ⇒ ZIO[R1, Nothing, Any])(implicit trace: ZTraceElement): ZIO[R1, Nothing, Unit]

    Permalink
  118. final def onError[R1 <: R](cleanup: (Cause[E]) ⇒ URIO[R1, Any])(implicit trace: ZTraceElement): ZIO[R1, E, A]

    Permalink

    Runs the specified effect if this effect fails, providing the error to the effect if it exists.

    Runs the specified effect if this effect fails, providing the error to the effect if it exists. The provided effect will not be interrupted.

  119. final def onExecutionContext(ec: ⇒ ExecutionContext)(implicit trace: ZTraceElement): ZIO[R, E, A]

    Permalink

    Executes the effect on the specified ExecutionContext and then shifts back to the default one.

  120. final def onExecutor(executor: ⇒ Executor)(implicit trace: ZTraceElement): ZIO[R, E, A]

    Permalink

    Returns an effect which is guaranteed to be executed on the specified executor.

    Returns an effect which is guaranteed to be executed on the specified executor. The specified effect will always run on the specified executor, even in the presence of asynchronous boundaries.

    This is useful when an effect must be executed somewhere, for example: on a UI thread, inside a client library's thread pool, inside a blocking thread pool, inside a low-latency thread pool, or elsewhere.

    The onExecutor function composes with the innermost onExecutor taking priority. Use of this method does not alter the execution semantics of other effects composed with this one, making it easy to compositionally reason about where effects are running.

  121. final def onExit[R1 <: R](cleanup: (Exit[E, A]) ⇒ URIO[R1, Any])(implicit trace: ZTraceElement): ZIO[R1, E, A]

    Permalink

    Ensures that a cleanup functions runs, whether this effect succeeds, fails, or is interrupted.

  122. final def onInterrupt[R1 <: R](cleanup: (Set[FiberId]) ⇒ URIO[R1, Any])(implicit trace: ZTraceElement): ZIO[R1, E, A]

    Permalink

    Calls the specified function, and runs the effect it returns, if this effect is interrupted.

  123. final def onInterrupt[R1 <: R](cleanup: ⇒ URIO[R1, Any])(implicit trace: ZTraceElement): ZIO[R1, E, A]

    Permalink

    Runs the specified effect if this effect is interrupted.

  124. final def onTermination[R1 <: R](cleanup: (Cause[Nothing]) ⇒ URIO[R1, Any])(implicit trace: ZTraceElement): ZIO[R1, E, A]

    Permalink

    Runs the specified effect if this effect is terminated, either because of a defect or because of interruption.

  125. final def once(implicit trace: ZTraceElement): UIO[ZIO[R, E, Unit]]

    Permalink

    Returns an effect that will be executed at most once, even if it is evaluated multiple times.

  126. final def option(implicit ev: CanFail[E], trace: ZTraceElement): URIO[R, Option[A]]

    Permalink

    Executes this effect, skipping the error but returning optionally the success.

  127. final def orDie(implicit ev1: IsSubtypeOfError[E, Throwable], ev2: CanFail[E], trace: ZTraceElement): URIO[R, A]

    Permalink

    Translates effect failure into death of the fiber, making all failures unchecked and not a part of the type of the effect.

  128. final def orDieWith(f: (E) ⇒ Throwable)(implicit ev: CanFail[E], trace: ZTraceElement): URIO[R, A]

    Permalink

    Keeps none of the errors, and terminates the fiber with them, using the specified function to convert the E into a Throwable.

  129. final def orElse[R1 <: R, E2, A1 >: A](that: ⇒ ZIO[R1, E2, A1])(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R1, E2, A1]

    Permalink

    Executes this effect and returns its value, if it succeeds, but otherwise executes the specified effect.

  130. final def orElseEither[R1 <: R, E2, B](that: ⇒ ZIO[R1, E2, B])(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R1, E2, Either[A, B]]

    Permalink

    Returns an effect that will produce the value of this effect, unless it fails, in which case, it will produce the value of the specified effect.

  131. final def orElseFail[E1](e1: ⇒ E1)(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R, E1, A]

    Permalink

    Executes this effect and returns its value, if it succeeds, but otherwise fails with the specified error.

  132. final def orElseOptional[R1 <: R, E1, A1 >: A](that: ⇒ ZIO[R1, Option[E1], A1])(implicit ev: IsSubtypeOfError[E, Option[E1]], trace: ZTraceElement): ZIO[R1, Option[E1], A1]

    Permalink

    Returns an effect that will produce the value of this effect, unless it fails with the None value, in which case it will produce the value of the specified effect.

  133. final def orElseSucceed[A1 >: A](a1: ⇒ A1)(implicit ev: CanFail[E], trace: ZTraceElement): URIO[R, A1]

    Permalink

    Executes this effect and returns its value, if it succeeds, but otherwise succeeds with the specified value.

  134. final def overrideForkScope(scope: ⇒ ZScope[Exit[Any, Any]])(implicit trace: ZTraceElement): ZIO[R, E, A]

    Permalink

    Returns a new effect that will utilize the specified scope to supervise any fibers forked within the original effect.

  135. final def parallelErrors[E1 >: E](implicit trace: ZTraceElement): ZIO[R, ::[E1], A]

    Permalink

    Exposes all parallel errors in a single call

  136. final def provide[E1 >: E, R0, R1](layer: ⇒ ZLayer[R0, E1, R1])(implicit ev: <:<[R1, R], trace: ZTraceElement): ZIO[R0, E1, A]

    Permalink

    Provides a layer to the ZIO effect, which translates it to another level.

  137. final def provideCustom[E1 >: E, R1](layer: ⇒ ZLayer[ZEnv, E1, R1])(implicit ev: <:<[ZEnv with R1, R], tagged: zio.Tag[R1], trace: ZTraceElement): ZIO[ZEnv, E1, A]

    Permalink

    Provides the part of the environment that is not part of the ZEnv, leaving an effect that only depends on the ZEnv.

    Provides the part of the environment that is not part of the ZEnv, leaving an effect that only depends on the ZEnv.

    val zio: ZIO[ZEnv with Logging, Nothing, Unit] = ???
    
    val loggingLayer: ZLayer[Any, Nothing, Logging] = ???
    
    val zio2 = zio.provideCustom(loggingLayer)
  138. final def provideEnvironment(r: ⇒ ZEnvironment[R])(implicit ev: NeedsEnv[R], trace: ZTraceElement): IO[E, A]

    Permalink

    Provides the ZIO effect with its required environment, which eliminates its dependency on R.

  139. final def provideSome[R0]: ProvideSome[R0, R, E, A]

    Permalink

    Splits the environment into two parts, providing one part using the specified layer and leaving the remainder R0.

    Splits the environment into two parts, providing one part using the specified layer and leaving the remainder R0.

    val zio: ZIO[Clock with Random, Nothing, Unit] = ???
    
    val clockLayer: ZLayer[Any, Nothing, Clock] = ???
    
    val zio2 = zio.provideSome[Random](clockLayer)
  140. final def provideSomeEnvironment[R0](f: (ZEnvironment[R0]) ⇒ ZEnvironment[R])(implicit ev: NeedsEnv[R], trace: ZTraceElement): ZIO[R0, E, A]

    Permalink

    Transforms the environment being provided to this effect with the specified function.

  141. final def race[R1 <: R, E1 >: E, A1 >: A](that: ⇒ ZIO[R1, E1, A1])(implicit trace: ZTraceElement): ZIO[R1, E1, A1]

    Permalink

    Returns an effect that races this effect with the specified effect, returning the first successful A from the faster side.

    Returns an effect that races this effect with the specified effect, returning the first successful A from the faster side. If one effect succeeds, the other will be interrupted. If neither succeeds, then the effect will fail with some error.

    WARNING: The raced effect will safely interrupt the "loser", but will not resume until the loser has been cleanly terminated. If early return is desired, then instead of performing l race r, perform l.disconnect race r.disconnect, which disconnects left and right interruption signals, allowing a fast return, with interruption performed in the background.

    Note that if the race is embedded into an uninterruptible region, then because the loser cannot be interrupted, it will be allowed to continue executing in the background, without delaying the return of the race.

  142. final def raceAll[R1 <: R, E1 >: E, A1 >: A](ios: ⇒ Iterable[ZIO[R1, E1, A1]])(implicit trace: ZTraceElement): ZIO[R1, E1, A1]

    Permalink

    Returns an effect that races this effect with all the specified effects, yielding the value of the first effect to succeed with a value.

    Returns an effect that races this effect with all the specified effects, yielding the value of the first effect to succeed with a value. Losers of the race will be interrupted immediately

  143. final def raceEither[R1 <: R, E1 >: E, B](that: ⇒ ZIO[R1, E1, B])(implicit trace: ZTraceElement): ZIO[R1, E1, Either[A, B]]

    Permalink

    Returns an effect that races this effect with the specified effect, yielding the first result to succeed.

    Returns an effect that races this effect with the specified effect, yielding the first result to succeed. If neither effect succeeds, then the composed effect will fail with some error.

    WARNING: The raced effect will safely interrupt the "loser", but will not resume until the loser has been cleanly terminated. If early return is desired, then instead of performing l raceEither r, perform l.disconnect raceEither r.disconnect, which disconnects left and right interrupt signal, allowing the earliest possible return.

  144. final def raceFirst[R1 <: R, E1 >: E, A1 >: A](that: ⇒ ZIO[R1, E1, A1])(implicit trace: ZTraceElement): ZIO[R1, E1, A1]

    Permalink

    Returns an effect that races this effect with the specified effect, yielding the first result to complete, whether by success or failure.

    Returns an effect that races this effect with the specified effect, yielding the first result to complete, whether by success or failure. If neither effect completes, then the composed effect will not complete.

    WARNING: The raced effect will safely interrupt the "loser", but will not resume until the loser has been cleanly terminated. If early return is desired, then instead of performing l raceFirst r, perform l.disconnect raceFirst r.disconnect, which disconnects left and right interrupt signal, allowing a fast return, with interruption performed in the background.

  145. final def raceWith[R1 <: R, E1, E2, B, C](that: ⇒ ZIO[R1, E1, B])(leftDone: (Exit[E, A], Fiber[E1, B]) ⇒ ZIO[R1, E2, C], rightDone: (Exit[E1, B], Fiber[E, A]) ⇒ ZIO[R1, E2, C], scope: ⇒ Option[ZScope[Exit[Any, Any]]] = None)(implicit trace: ZTraceElement): ZIO[R1, E2, C]

    Permalink

    Returns an effect that races this effect with the specified effect, calling the specified finisher as soon as one result or the other has been computed.

  146. final def refineOrDie[E1](pf: PartialFunction[E, E1])(implicit ev1: IsSubtypeOfError[E, Throwable], ev2: CanFail[E], trace: ZTraceElement): ZIO[R, E1, A]

    Permalink

    Keeps some of the errors, and terminates the fiber with the rest

  147. final def refineOrDieWith[E1](pf: PartialFunction[E, E1])(f: (E) ⇒ Throwable)(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R, E1, A]

    Permalink

    Keeps some of the errors, and terminates the fiber with the rest, using the specified function to convert the E into a Throwable.

  148. final def reject[E1 >: E](pf: PartialFunction[A, E1])(implicit trace: ZTraceElement): ZIO[R, E1, A]

    Permalink

    Fail with the returned value if the PartialFunction matches, otherwise continue with our held value.

  149. final def rejectZIO[R1 <: R, E1 >: E](pf: PartialFunction[A, ZIO[R1, E1, E1]])(implicit trace: ZTraceElement): ZIO[R1, E1, A]

    Permalink

    Continue with the returned computation if the PartialFunction matches, translating the successful match into a failure, otherwise continue with our held value.

  150. final def repeat[R1 <: R, B](schedule: ⇒ Schedule[R1, A, B])(implicit trace: ZTraceElement): ZIO[R1 with Clock, E, B]

    Permalink

    Returns a new effect that repeats this effect according to the specified schedule or until the first failure.

    Returns a new effect that repeats this effect according to the specified schedule or until the first failure. Scheduled recurrences are in addition to the first execution, so that io.repeat(Schedule.once) yields an effect that executes io, and then if that succeeds, executes io an additional time.

  151. final def repeatN(n: ⇒ Int)(implicit trace: ZTraceElement): ZIO[R, E, A]

    Permalink

    Returns a new effect that repeats this effect the specified number of times or until the first failure.

    Returns a new effect that repeats this effect the specified number of times or until the first failure. Repeats are in addition to the first execution, so that io.repeatN(1) yields an effect that executes io, and then if that succeeds, executes io an additional time.

  152. final def repeatOrElse[R1 <: R, E2, B](schedule: ⇒ Schedule[R1, A, B], orElse: (E, Option[B]) ⇒ ZIO[R1, E2, B])(implicit trace: ZTraceElement): ZIO[R1 with Clock, E2, B]

    Permalink

    Returns a new effect that repeats this effect according to the specified schedule or until the first failure, at which point, the failure value and schedule output are passed to the specified handler.

    Returns a new effect that repeats this effect according to the specified schedule or until the first failure, at which point, the failure value and schedule output are passed to the specified handler.

    Scheduled recurrences are in addition to the first execution, so that io.repeat(Schedule.once) yields an effect that executes io, and then if that succeeds, executes io an additional time.

  153. final def repeatOrElseEither[R1 <: R, B, E2, C](schedule: ⇒ Schedule[R1, A, B], orElse: (E, Option[B]) ⇒ ZIO[R1, E2, C])(implicit trace: ZTraceElement): ZIO[R1 with Clock, E2, Either[C, B]]

    Permalink

    Returns a new effect that repeats this effect according to the specified schedule or until the first failure, at which point, the failure value and schedule output are passed to the specified handler.

    Returns a new effect that repeats this effect according to the specified schedule or until the first failure, at which point, the failure value and schedule output are passed to the specified handler.

    Scheduled recurrences are in addition to the first execution, so that io.repeat(Schedule.once) yields an effect that executes io, and then if that succeeds, executes io an additional time.

  154. final def repeatUntil(p: (A) ⇒ Boolean)(implicit trace: ZTraceElement): ZIO[R, E, A]

    Permalink

    Repeats this effect until its value satisfies the specified predicate or until the first failure.

  155. final def repeatUntilEquals[A1 >: A](a: ⇒ A1)(implicit trace: ZTraceElement): ZIO[R, E, A1]

    Permalink

    Repeats this effect until its value is equal to the specified value or until the first failure.

  156. final def repeatUntilZIO[R1 <: R](f: (A) ⇒ URIO[R1, Boolean])(implicit trace: ZTraceElement): ZIO[R1, E, A]

    Permalink

    Repeats this effect until its value satisfies the specified effectful predicate or until the first failure.

  157. final def repeatWhile(p: (A) ⇒ Boolean)(implicit trace: ZTraceElement): ZIO[R, E, A]

    Permalink

    Repeats this effect while its value satisfies the specified predicate or until the first failure.

  158. final def repeatWhileEquals[A1 >: A](a: ⇒ A1)(implicit trace: ZTraceElement): ZIO[R, E, A1]

    Permalink

    Repeats this effect for as long as its value is equal to the specified value or until the first failure.

  159. final def repeatWhileZIO[R1 <: R](f: (A) ⇒ URIO[R1, Boolean])(implicit trace: ZTraceElement): ZIO[R1, E, A]

    Permalink

    Repeats this effect while its value satisfies the specified effectful predicate or until the first failure.

  160. final def replicateZIO(n: ⇒ Int)(implicit trace: ZTraceElement): ZIO[R, E, Iterable[A]]

    Permalink

    Performs this effect the specified number of times and collects the results.

  161. final def replicateZIODiscard(n: ⇒ Int)(implicit trace: ZTraceElement): ZIO[R, E, Unit]

    Permalink

    Performs this effect the specified number of times, discarding the results.

  162. final def resetForkScope(implicit trace: ZTraceElement): ZIO[R, E, A]

    Permalink

    Returns a new effect that will utilize the default scope (fiber scope) to supervise any fibers forked within the original effect.

  163. final def resurrect(implicit ev1: IsSubtypeOfError[E, Throwable], trace: ZTraceElement): RIO[R, A]

    Permalink

    Unearth the unchecked failure of the effect.

    Unearth the unchecked failure of the effect. (opposite of orDie)

    val f0: Task[Unit] = ZIO.fail(new Exception("failing")).unit
    val f1: UIO[Unit]  = f0.orDie
    val f2: Task[Unit] = f1.resurrect
  164. final def retry[R1 <: R, S](policy: ⇒ Schedule[R1, E, S])(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R1 with Clock, E, A]

    Permalink

    Retries with the specified retry policy.

    Retries with the specified retry policy. Retries are done following the failure of the original io (up to a fixed maximum with once or recurs for example), so that that io.retry(Schedule.once) means "execute io and in case of failure, try again once".

  165. final def retryN(n: ⇒ Int)(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R, E, A]

    Permalink

    Retries this effect the specified number of times.

  166. final def retryOrElse[R1 <: R, A1 >: A, S, E1](policy: ⇒ Schedule[R1, E, S], orElse: (E, S) ⇒ ZIO[R1, E1, A1])(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R1 with Clock, E1, A1]

    Permalink

    Retries with the specified schedule, until it fails, and then both the value produced by the schedule together with the last error are passed to the recovery function.

  167. final def retryOrElseEither[R1 <: R, Out, E1, B](schedule: ⇒ Schedule[R1, E, Out], orElse: (E, Out) ⇒ ZIO[R1, E1, B])(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R1 with Clock, E1, Either[B, A]]

    Permalink

    Returns an effect that retries this effect with the specified schedule when it fails, until the schedule is done, then both the value produced by the schedule together with the last error are passed to the specified recovery function.

  168. final def retryUntil(f: (E) ⇒ Boolean)(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R, E, A]

    Permalink

    Retries this effect until its error satisfies the specified predicate.

  169. final def retryUntilEquals[E1 >: E](e: ⇒ E1)(implicit ev: CanFail[E1], trace: ZTraceElement): ZIO[R, E1, A]

    Permalink

    Retries this effect until its error is equal to the specified error.

  170. final def retryUntilZIO[R1 <: R](f: (E) ⇒ URIO[R1, Boolean])(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R1, E, A]

    Permalink

    Retries this effect until its error satisfies the specified effectful predicate.

  171. final def retryWhile(f: (E) ⇒ Boolean)(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R, E, A]

    Permalink

    Retries this effect while its error satisfies the specified predicate.

  172. final def retryWhileEquals[E1 >: E](e: ⇒ E1)(implicit ev: CanFail[E1], trace: ZTraceElement): ZIO[R, E1, A]

    Permalink

    Retries this effect for as long as its error is equal to the specified error.

  173. final def retryWhileZIO[R1 <: R](f: (E) ⇒ URIO[R1, Boolean])(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R1, E, A]

    Permalink

    Retries this effect while its error satisfies the specified effectful predicate.

  174. final def right[B, C](implicit ev: IsSubtypeOfOutput[A, Either[B, C]], trace: ZTraceElement): ZIO[R, Either[B, E], C]

    Permalink

    "Zooms in" on the value in the Right side of an Either, moving the possibility that the value is a Left to the error channel.

  175. final def sandbox(implicit trace: ZTraceElement): ZIO[R, Cause[E], A]

    Permalink

    Exposes the full cause of failure of this effect.

    Exposes the full cause of failure of this effect.

    final case class DomainError()
    
    val veryBadIO: IO[DomainError, Unit] =
      IO.succeed(5 / 0) *> IO.fail(DomainError())
    
    val caught: IO[DomainError, Unit] =
      veryBadIO.sandbox.mapError(_.untraced).catchAll {
        case Cause.Die(_: ArithmeticException) =>
          // Caught defect: divided by zero!
          IO.unit
        case Cause.Fail(_) =>
          // Caught error: DomainError!
          IO.unit
        case cause =>
          // Caught unknown defects, shouldn't recover!
          IO.failCause(cause)
      }
  176. final def sandboxWith[R1 <: R, E2, B](f: (ZIO[R1, Cause[E], A]) ⇒ ZIO[R1, Cause[E2], B])(implicit trace: ZTraceElement): ZIO[R1, E2, B]

    Permalink

    Companion helper to sandbox.

    Companion helper to sandbox. Allows recovery, and partial recovery, from errors and defects alike, as in:

    case class DomainError()
    
    val veryBadIO: IO[DomainError, Unit] =
      IO.succeed(5 / 0) *> IO.fail(DomainError())
    
    val caught: IO[DomainError, Unit] =
      veryBadIO.sandboxWith(_.catchSome {
        case Cause.Die(_: ArithmeticException)=>
          // Caught defect: divided by zero!
          IO.succeed(0)
      })

    Using sandboxWith with catchSome is better than using io.sandbox.catchAll with a partial match, because in the latter, if the match fails, the original defects will be lost and replaced by a MatchError

  177. final def schedule[R1 <: R, B](schedule: ⇒ Schedule[R1, Any, B])(implicit trace: ZTraceElement): ZIO[R1 with Clock, E, B]

    Permalink

    Runs this effect according to the specified schedule.

    Runs this effect according to the specified schedule.

    See scheduleFrom for a variant that allows the schedule's decision to depend on the result of this effect.

  178. final def scheduleFrom[R1 <: R, A1 >: A, B](a: ⇒ A1)(schedule: ⇒ Schedule[R1, A1, B])(implicit trace: ZTraceElement): ZIO[R1 with Clock, E, B]

    Permalink

    Runs this effect according to the specified schedule starting from the specified input value.

  179. final def some[B](implicit ev: IsSubtypeOfOutput[A, Option[B]], trace: ZTraceElement): ZIO[R, Option[E], B]

    Permalink

    Converts an option on values into an option on errors.

  180. final def someOrElse[B](default: ⇒ B)(implicit ev: IsSubtypeOfOutput[A, Option[B]], trace: ZTraceElement): ZIO[R, E, B]

    Permalink

    Extracts the optional value, or returns the given 'default'.

  181. final def someOrElseZIO[B, R1 <: R, E1 >: E](default: ⇒ ZIO[R1, E1, B])(implicit ev: IsSubtypeOfOutput[A, Option[B]], trace: ZTraceElement): ZIO[R1, E1, B]

    Permalink

    Extracts the optional value, or executes the effect 'default'.

  182. final def someOrFail[B, E1 >: E](e: ⇒ E1)(implicit ev: IsSubtypeOfOutput[A, Option[B]], trace: ZTraceElement): ZIO[R, E1, B]

    Permalink

    Extracts the optional value, or fails with the given error 'e'.

  183. final def someOrFailException[B, E1 >: E](implicit ev: IsSubtypeOfOutput[A, Option[B]], ev2: <:<[NoSuchElementException, E1], trace: ZTraceElement): ZIO[R, E1, B]

    Permalink

    Extracts the optional value, or fails with a java.util.NoSuchElementException

  184. final def summarized[R1 <: R, E1 >: E, B, C](summary0: ⇒ ZIO[R1, E1, B])(f: (B, B) ⇒ C)(implicit trace: ZTraceElement): ZIO[R1, E1, (C, A)]

    Permalink

    Summarizes a effect by computing some value before and after execution, and then combining the values to produce a summary, together with the result of execution.

  185. final def supervised(supervisor: ⇒ Supervisor[Any])(implicit trace: ZTraceElement): ZIO[R, E, A]

    Permalink

    Returns an effect with the behavior of this one, but where all child fibers forked in the effect are reported to the specified supervisor.

  186. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  187. final def tap[R1 <: R, E1 >: E](f: (A) ⇒ ZIO[R1, E1, Any])(implicit trace: ZTraceElement): ZIO[R1, E1, A]

    Permalink

    Returns an effect that effectfully "peeks" at the success of this effect.

    Returns an effect that effectfully "peeks" at the success of this effect.

    readFile("data.json").tap(printLine)
  188. final def tapBoth[R1 <: R, E1 >: E](f: (E) ⇒ ZIO[R1, E1, Any], g: (A) ⇒ ZIO[R1, E1, Any])(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R1, E1, A]

    Permalink

    Returns an effect that effectfully "peeks" at the failure or success of this effect.

    Returns an effect that effectfully "peeks" at the failure or success of this effect.

    readFile("data.json").tapBoth(logError(_), logData(_))
  189. final def tapDefect[R1 <: R, E1 >: E](f: (Cause[Nothing]) ⇒ ZIO[R1, E1, Any])(implicit trace: ZTraceElement): ZIO[R1, E1, A]

    Permalink

    Returns an effect that effectually "peeks" at the defect of this effect.

  190. final def tapEither[R1 <: R, E1 >: E](f: (Either[E, A]) ⇒ ZIO[R1, E1, Any])(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R1, E1, A]

    Permalink

    Returns an effect that effectfully "peeks" at the result of this effect.

    Returns an effect that effectfully "peeks" at the result of this effect.

    readFile("data.json").tapEither(result => log(result.fold("Error: " + _, "Success: " + _)))
  191. final def tapError[R1 <: R, E1 >: E](f: (E) ⇒ ZIO[R1, E1, Any])(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R1, E1, A]

    Permalink

    Returns an effect that effectfully "peeks" at the failure of this effect.

    Returns an effect that effectfully "peeks" at the failure of this effect.

    readFile("data.json").tapError(logError(_))
  192. final def tapErrorCause[R1 <: R, E1 >: E](f: (Cause[E]) ⇒ ZIO[R1, E1, Any])(implicit trace: ZTraceElement): ZIO[R1, E1, A]

    Permalink

    Returns an effect that effectually "peeks" at the cause of the failure of this effect.

    Returns an effect that effectually "peeks" at the cause of the failure of this effect.

    readFile("data.json").tapErrorCause(logCause(_))
  193. final def tapErrorTrace[R1 <: R, E1 >: E](f: ((E, ZTrace)) ⇒ ZIO[R1, E1, Any])(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R1, E1, A]

    Permalink

    A version of tapError that gives you the trace of the error.

  194. final def tapSome[R1 <: R, E1 >: E](f: PartialFunction[A, ZIO[R1, E1, Any]])(implicit trace: ZTraceElement): ZIO[R1, E1, A]

    Permalink

    Returns an effect that effectfully "peeks" at the success of this effect.

    Returns an effect that effectfully "peeks" at the success of this effect. If the partial function isn't defined at the input, the result is equivalent to the original effect.

    readFile("data.json").tapSome {
      case content if content.nonEmpty => putStrLn(content)
    }
  195. final def timed(implicit trace: ZTraceElement): ZIO[R with Clock, E, (zio.Duration, A)]

    Permalink

    Returns a new effect that executes this one and times the execution.

  196. final def timedWith[R1 <: R, E1 >: E](nanoTime: ⇒ ZIO[R1, E1, Long])(implicit trace: ZTraceElement): ZIO[R1, E1, (zio.Duration, A)]

    Permalink

    A more powerful variation of timed that allows specifying the Clock.

  197. final def timeout(d: ⇒ zio.Duration)(implicit trace: ZTraceElement): ZIO[R with Clock, E, Option[A]]

    Permalink

    Returns an effect that will timeout this effect, returning None if the timeout elapses before the effect has produced a value; and returning Some of the produced value otherwise.

    Returns an effect that will timeout this effect, returning None if the timeout elapses before the effect has produced a value; and returning Some of the produced value otherwise.

    If the timeout elapses without producing a value, the running effect will be safely interrupted.

    WARNING: The effect returned by this method will not itself return until the underlying effect is actually interrupted. This leads to more predictable resource utilization. If early return is desired, then instead of using effect.timeout(d), use effect.disconnect.timeout(d), which first disconnects the effect's interruption signal before performing the timeout, resulting in earliest possible return, before an underlying effect has been successfully interrupted.

  198. final def timeoutFail[E1 >: E](e: ⇒ E1)(d: ⇒ zio.Duration)(implicit trace: ZTraceElement): ZIO[R with Clock, E1, A]

    Permalink

    The same as timeout, but instead of producing a None in the event of timeout, it will produce the specified error.

  199. final def timeoutFailCause[E1 >: E](cause: ⇒ Cause[E1])(d: ⇒ zio.Duration)(implicit trace: ZTraceElement): ZIO[R with Clock, E1, A]

    Permalink

    The same as timeout, but instead of producing a None in the event of timeout, it will produce the specified failure.

  200. final def timeoutTo[B](b: ⇒ B): TimeoutTo[R, E, A, B]

    Permalink

    Returns an effect that will timeout this effect, returning either the default value if the timeout elapses before the effect has produced a value; and or returning the result of applying the function f to the success value of the effect.

    Returns an effect that will timeout this effect, returning either the default value if the timeout elapses before the effect has produced a value; and or returning the result of applying the function f to the success value of the effect.

    If the timeout elapses without producing a value, the running effect will be safely interrupted

    IO.succeed(1).timeoutTo(None)(Some(_))(1.second)
  201. def toCompletableFuture[A1 >: A](implicit ev: IsSubtypeOfError[E, Throwable], trace: ZTraceElement): URIO[R, CompletableFuture[A1]]

    Permalink
    Definition Classes
    ZIOPlatformSpecific
  202. def toCompletableFutureWith[A1 >: A](f: (E) ⇒ Throwable)(implicit trace: ZTraceElement): URIO[R, CompletableFuture[A1]]

    Permalink
    Definition Classes
    ZIOPlatformSpecific
  203. final def toFuture(implicit ev2: IsSubtypeOfError[E, Throwable], trace: ZTraceElement): URIO[R, CancelableFuture[A]]

    Permalink

    Converts the effect into a scala.concurrent.Future.

  204. final def toFutureWith(f: (E) ⇒ Throwable)(implicit trace: ZTraceElement): URIO[R, CancelableFuture[A]]

    Permalink

    Converts the effect into a scala.concurrent.Future.

  205. final def toLayer[A1 >: A](implicit ev1: zio.Tag[A1], ev2: IsNotIntersection[A1], trace: ZTraceElement): ZLayer[R, E, A1]

    Permalink

    Constructs a layer from this effect.

  206. final def toLayerEnvironment[B](implicit ev: <:<[A, ZEnvironment[B]], trace: ZTraceElement): ZLayer[R, E, B]

    Permalink

    Constructs a layer from this effect, which must return one or more services.

  207. final def toManaged(implicit trace: ZTraceElement): ZManaged[R, E, A]

    Permalink

    Converts this ZIO to zio.ZManaged with no release action.

    Converts this ZIO to zio.ZManaged with no release action. It will be performed interruptibly.

  208. final def toManagedWith[R1 <: R](release: (A) ⇒ URIO[R1, Any])(implicit trace: ZTraceElement): ZManaged[R1, E, A]

    Permalink

    Converts this ZIO to zio.Managed.

    Converts this ZIO to zio.Managed. This ZIO and the provided release action will be performed uninterruptibly.

  209. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  210. final def unary_![R1 <: R, E1 >: E](implicit ev: <:<[A, Boolean], trace: ZTraceElement): ZIO[R1, E1, Boolean]

    Permalink

    Returns the logical negation of the Boolean value returned by this effect.

  211. final def uncause[E1 >: E](implicit ev: IsSubtypeOfOutput[A, Cause[E1]], trace: ZTraceElement): ZIO[R, E1, Unit]

    Permalink

    When this effect succeeds with a cause, then this method returns a new effect that either fails with the cause that this effect succeeded with, or succeeds with unit, depending on whether the cause is empty.

    When this effect succeeds with a cause, then this method returns a new effect that either fails with the cause that this effect succeeded with, or succeeds with unit, depending on whether the cause is empty.

    This operation is the opposite of cause.

  212. final def uninterruptible(implicit trace: ZTraceElement): ZIO[R, E, A]

    Permalink

    Performs this effect uninterruptibly.

    Performs this effect uninterruptibly. This will prevent the effect from being terminated externally, but the effect may fail for internal reasons (e.g. an uncaught error) or terminate due to defect.

    Uninterruptible effects may recover from all failure causes (including interruption of an inner effect that has been made interruptible).

  213. final def unit(implicit trace: ZTraceElement): ZIO[R, E, Unit]

    Permalink

    Returns the effect resulting from mapping the success of this effect to unit.

  214. final def unleft[E1, B](implicit ev: IsSubtypeOfError[E, Either[E1, B]], trace: ZTraceElement): ZIO[R, E1, Either[A, B]]

    Permalink

    Converts a ZIO[R, Either[E, B], A] into a ZIO[R, E, Either[A, B]].

    Converts a ZIO[R, Either[E, B], A] into a ZIO[R, E, Either[A, B]]. The inverse of left.

  215. final def unless(p: ⇒ Boolean)(implicit trace: ZTraceElement): ZIO[R, E, Option[A]]

    Permalink

    The moral equivalent of if (!p) exp

  216. final def unlessZIO[R1 <: R, E1 >: E](p: ⇒ ZIO[R1, E1, Boolean])(implicit trace: ZTraceElement): ZIO[R1, E1, Option[A]]

    Permalink

    The moral equivalent of if (!p) exp when p has side-effects

  217. final def unrefine[E1 >: E](pf: PartialFunction[Throwable, E1])(implicit trace: ZTraceElement): ZIO[R, E1, A]

    Permalink

    Takes some fiber failures and converts them into errors.

  218. final def unrefineTo[E1 >: E](implicit arg0: ClassTag[E1], trace: ZTraceElement): ZIO[R, E1, A]

    Permalink

    Takes some fiber failures and converts them into errors.

  219. final def unrefineWith[E1](pf: PartialFunction[Throwable, E1])(f: (E) ⇒ E1)(implicit trace: ZTraceElement): ZIO[R, E1, A]

    Permalink

    Takes some fiber failures and converts them into errors, using the specified function to convert the E into an E1.

  220. final def unright[E1, B](implicit ev: IsSubtypeOfError[E, Either[B, E1]], trace: ZTraceElement): ZIO[R, E1, Either[B, A]]

    Permalink

    Converts a ZIO[R, Either[B, E], A] into a ZIO[R, E, Either[B, A]].

    Converts a ZIO[R, Either[B, E], A] into a ZIO[R, E, Either[B, A]]. The inverse of right.

  221. final def unsandbox[E1](implicit ev: IsSubtypeOfError[E, Cause[E1]], trace: ZTraceElement): ZIO[R, E1, A]

    Permalink

    The inverse operation to sandbox.

    The inverse operation to sandbox. Submerges the full cause of failure.

  222. final def unsome[E1](implicit ev: IsSubtypeOfError[E, Option[E1]], trace: ZTraceElement): ZIO[R, E1, Option[A]]

    Permalink

    Converts an option on errors into an option on values.

  223. final def updateService[M]: UpdateService[R, E, A, M]

    Permalink

    Updates a service in the environment of this effect.

  224. final def updateServiceAt[Service]: UpdateServiceAt[R, E, A, Service]

    Permalink

    Updates a service at the specified key in the environment of this effect.

  225. final def validate[R1 <: R, E1 >: E, B](that: ⇒ ZIO[R1, E1, B])(implicit trace: ZTraceElement): ZIO[R1, E1, (A, B)]

    Permalink

    Sequentially zips the this result with the specified result.

    Sequentially zips the this result with the specified result. Combines both Cause[E1] when both effects fail.

  226. final def validatePar[R1 <: R, E1 >: E, B](that: ⇒ ZIO[R1, E1, B])(implicit trace: ZTraceElement): ZIO[R1, E1, (A, B)]

    Permalink

    Returns an effect that executes both this effect and the specified effect, in parallel.

    Returns an effect that executes both this effect and the specified effect, in parallel. Combines both Cause[E1] when both effects fail.

  227. final def validateWith[R1 <: R, E1 >: E, B, C](that: ⇒ ZIO[R1, E1, B])(f: (A, B) ⇒ C)(implicit trace: ZTraceElement): ZIO[R1, E1, C]

    Permalink

    Sequentially zips this effect with the specified effect using the specified combiner function.

    Sequentially zips this effect with the specified effect using the specified combiner function. Combines the causes in case both effect fail.

  228. final def validateWithPar[R1 <: R, E1 >: E, B, C](that: ⇒ ZIO[R1, E1, B])(f: (A, B) ⇒ C)(implicit trace: ZTraceElement): ZIO[R1, E1, C]

    Permalink

    Returns an effect that executes both this effect and the specified effect, in parallel, combining their results with the specified f function.

    Returns an effect that executes both this effect and the specified effect, in parallel, combining their results with the specified f function. If both sides fail, then the cause will be combined.

  229. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  230. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  231. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  232. final def when(p: ⇒ Boolean)(implicit trace: ZTraceElement): ZIO[R, E, Option[A]]

    Permalink

    The moral equivalent of if (p) exp

  233. final def whenZIO[R1 <: R, E1 >: E](p: ⇒ ZIO[R1, E1, Boolean])(implicit trace: ZTraceElement): ZIO[R1, E1, Option[A]]

    Permalink

    The moral equivalent of if (p) exp when p has side-effects

  234. final def withParallelism(n: ⇒ Int)(implicit trace: ZTraceElement): ZIO[R, E, A]

    Permalink

    Runs this effect with the specified maximum number of fibers for parallel operators.

  235. def withParallelismUnbounded(implicit trace: ZTraceElement): ZIO[R, E, A]

    Permalink

    Runs this effect with an unbounded maximum number of fibers for parallel operators.

  236. final def withRuntimeConfig(runtimeConfig: ⇒ RuntimeConfig)(implicit trace: ZTraceElement): ZIO[R, E, A]

    Permalink

    Runs this effect on the specified runtime configuration, restoring the old runtime configuration when it completes execution.

  237. final def zip[R1 <: R, E1 >: E, B](that: ⇒ ZIO[R1, E1, B])(implicit zippable: Zippable[A, B], trace: ZTraceElement): ZIO[R1, E1, Out]

    Permalink

    A named alias for &&& or <*>.

  238. final def zipLeft[R1 <: R, E1 >: E, B](that: ⇒ ZIO[R1, E1, B])(implicit trace: ZTraceElement): ZIO[R1, E1, A]

    Permalink

    A named alias for <*.

  239. final def zipPar[R1 <: R, E1 >: E, B](that: ⇒ ZIO[R1, E1, B])(implicit zippable: Zippable[A, B], trace: ZTraceElement): ZIO[R1, E1, Out]

    Permalink

    A named alias for <&>.

  240. final def zipParLeft[R1 <: R, E1 >: E, B](that: ⇒ ZIO[R1, E1, B])(implicit trace: ZTraceElement): ZIO[R1, E1, A]

    Permalink

    A named alias for <&.

  241. final def zipParRight[R1 <: R, E1 >: E, B](that: ⇒ ZIO[R1, E1, B])(implicit trace: ZTraceElement): ZIO[R1, E1, B]

    Permalink

    A named alias for &>.

  242. final def zipRight[R1 <: R, E1 >: E, B](that: ⇒ ZIO[R1, E1, B])(implicit trace: ZTraceElement): ZIO[R1, E1, B]

    Permalink

    A named alias for *>.

  243. final def zipWith[R1 <: R, E1 >: E, B, C](that: ⇒ ZIO[R1, E1, B])(f: (A, B) ⇒ C)(implicit trace: ZTraceElement): ZIO[R1, E1, C]

    Permalink

    Sequentially zips this effect with the specified effect using the specified combiner function.

  244. final def zipWithPar[R1 <: R, E1 >: E, B, C](that: ⇒ ZIO[R1, E1, B])(f: (A, B) ⇒ C)(implicit trace: ZTraceElement): ZIO[R1, E1, C]

    Permalink

    Returns an effect that executes both this effect and the specified effect, in parallel, combining their results with the specified f function.

    Returns an effect that executes both this effect and the specified effect, in parallel, combining their results with the specified f function. If either side fails, then the other side will be interrupted.

  245. final def ||[R1 <: R, E1 >: E](that: ⇒ ZIO[R1, E1, Boolean])(implicit ev: <:<[A, Boolean], trace: ZTraceElement): ZIO[R1, E1, Boolean]

    Permalink

    Returns the logical conjunction of the Boolean value returned by this effect and the Boolean value returned by the specified effect.

    Returns the logical conjunction of the Boolean value returned by this effect and the Boolean value returned by the specified effect. This operator has "short circuiting" behavior so if the value returned by this effect is true the specified effect will not be evaluated.

Deprecated Value Members

  1. final def &&&[R1 <: R, E1 >: E, B](that: ⇒ ZIO[R1, E1, B])(implicit zippable: Zippable[A, B], trace: ZTraceElement): ZIO[R1, E1, Out]

    Permalink

    Sequentially zips this effect with the specified effect, combining the results into a tuple.

    Sequentially zips this effect with the specified effect, combining the results into a tuple.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use zip

  2. final def >>=[R1 <: R, E1 >: E, B](k: (A) ⇒ ZIO[R1, E1, B])(implicit trace: ZTraceElement): ZIO[R1, E1, B]

    Permalink

    Alias for flatMap.

    Alias for flatMap.

    val parsed = readFile("foo.txt") >>= parseFile
    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use flatMap

  3. final def asService[A1 >: A](implicit arg0: zio.Tag[A1], arg1: IsNotIntersection[A1], trace: ZTraceElement): ZIO[R, E, ZEnvironment[A1]]

    Permalink

    Maps the success value of this effect to a service.

    Maps the success value of this effect to a service.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use toLayer

  4. final def bimap[E2, B](f: (E) ⇒ E2, g: (A) ⇒ B)(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R, E2, B]

    Permalink

    Returns an effect whose failure and success channels have been mapped by the specified pair of functions, f and g.

    Returns an effect whose failure and success channels have been mapped by the specified pair of functions, f and g.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use mapBoth

  5. final def bracket: Acquire[R, E, A]

    Permalink

    Shorthand for the curried version of ZIO.bracket.

    Shorthand for the curried version of ZIO.bracket.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use acquireReleaseWith

  6. final def bracket[R1 <: R, E1 >: E, B](release: (A) ⇒ URIO[R1, Any], use: (A) ⇒ ZIO[R1, E1, B])(implicit trace: ZTraceElement): ZIO[R1, E1, B]

    Permalink

    Shorthand for the uncurried version of ZIO.bracket.

    Shorthand for the uncurried version of ZIO.bracket.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use acquireReleaseWith

  7. final def bracketExit: AcquireExit[R, E, A]

    Permalink

    Shorthand for the curried version of ZIO.bracketExit.

    Shorthand for the curried version of ZIO.bracketExit.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use acquireReleaseExitWith

  8. final def bracketExit[R1 <: R, E1 >: E, B](release: (A, Exit[E1, B]) ⇒ URIO[R1, Any], use: (A) ⇒ ZIO[R1, E1, B])(implicit trace: ZTraceElement): ZIO[R1, E1, B]

    Permalink

    Shorthand for the uncurried version of ZIO.bracketExit.

    Shorthand for the uncurried version of ZIO.bracketExit.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use acquireReleaseExitWith

  9. final def bracketOnError[R1 <: R, E1 >: E, B](release: (A) ⇒ URIO[R1, Any])(use: (A) ⇒ ZIO[R1, E1, B])(implicit trace: ZTraceElement): ZIO[R1, E1, B]

    Permalink

    Executes the release effect only if there was an error.

    Executes the release effect only if there was an error.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use acquireReleaseOnErrorWith

  10. final def bracket_[R1 <: R, E1 >: E, B](release: ⇒ URIO[R1, Any], use: ⇒ ZIO[R1, E1, B])(implicit trace: ZTraceElement): ZIO[R1, E1, B]

    Permalink

    Uncurried version.

    Uncurried version. Doesn't offer curried syntax and has worse type-inference characteristics, but it doesn't allocate intermediate zio.ZIO.AcquireDiscard and zio.ZIO.ReleaseDiscard objects.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use acquireRelease

  11. final def bracket_[R1 <: R, E1 >: E]: AcquireDiscard[R1, E1]

    Permalink

    A less powerful variant of bracket where the resource acquired by this effect is not needed.

    A less powerful variant of bracket where the resource acquired by this effect is not needed.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use acquireRelease

  12. final def collectM[R1 <: R, E1 >: E, B](e: ⇒ E1)(pf: PartialFunction[A, ZIO[R1, E1, B]])(implicit trace: ZTraceElement): ZIO[R1, E1, B]

    Permalink

    Fail with e if the supplied PartialFunction does not match, otherwise continue with the returned value.

    Fail with e if the supplied PartialFunction does not match, otherwise continue with the returned value.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use collectZIO

  13. final def filterOrElse_[R1 <: R, E1 >: E, A1 >: A](p: (A) ⇒ Boolean)(zio: ⇒ ZIO[R1, E1, A1])(implicit trace: ZTraceElement): ZIO[R1, E1, A1]

    Permalink

    Supplies zio if the predicate fails.

    Supplies zio if the predicate fails.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use filterOrElse

  14. final def foldCauseM[R1 <: R, E2, B](failure: (Cause[E]) ⇒ ZIO[R1, E2, B], success: (A) ⇒ ZIO[R1, E2, B])(implicit trace: ZTraceElement): ZIO[R1, E2, B]

    Permalink

    A more powerful version of fold that allows recovering from any kind of failure except interruptions.

    A more powerful version of fold that allows recovering from any kind of failure except interruptions.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use foldCauseZIO

  15. final def foldM[R1 <: R, E2, B](failure: (E) ⇒ ZIO[R1, E2, B], success: (A) ⇒ ZIO[R1, E2, B])(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R1, E2, B]

    Permalink

    Recovers from errors by accepting one effect to execute for the case of an error, and one effect to execute for the case of success.

    Recovers from errors by accepting one effect to execute for the case of an error, and one effect to execute for the case of success.

    This method has better performance than either since no intermediate value is allocated and does not require subsequent calls to flatMap to define the next effect.

    The error parameter of the returned IO may be chosen arbitrarily, since it will depend on the IOs returned by the given continuations.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use foldZIO

  16. final def foldTraceM[R1 <: R, E2, B](failure: ((E, ZTrace)) ⇒ ZIO[R1, E2, B], success: (A) ⇒ ZIO[R1, E2, B])(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R1, E2, B]

    Permalink

    A version of foldM that gives you the trace of the error.

    A version of foldM that gives you the trace of the error.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use foldTraceZIO

  17. final def forkInternal(implicit trace: ZTraceElement): ZIO[R, Nothing, Fiber.Runtime[E, A]]

    Permalink

    Forks an effect that will be executed without unhandled failures being reported.

    Forks an effect that will be executed without unhandled failures being reported. This is useful for implementing combinators that handle failures themselves.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use fork

  18. final def forkOn(ec: ⇒ ExecutionContext)(implicit trace: ZTraceElement): ZIO[R, E, Fiber.Runtime[E, A]]

    Permalink

    Forks an effect that will be executed on the specified ExecutionContext.

    Forks an effect that will be executed on the specified ExecutionContext.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use onExecutionContext(ec).fork

  19. final def get[B](implicit ev1: IsSubtypeOfError[E, Nothing], ev2: IsSubtypeOfOutput[A, Option[B]], trace: ZTraceElement): ZIO[R, Option[Nothing], B]

    Permalink

    Unwraps the optional success of this effect, but can fail with an None value.

    Unwraps the optional success of this effect, but can fail with an None value.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use some

  20. final def lock(executor: ⇒ Executor)(implicit trace: ZTraceElement): ZIO[R, E, A]

    Permalink

    Returns an effect which is guaranteed to be executed on the specified executor.

    Returns an effect which is guaranteed to be executed on the specified executor. The specified effect will always run on the specified executor, even in the presence of asynchronous boundaries.

    This is useful when an effect must be executed somewhere, for example: on a UI thread, inside a client library's thread pool, inside a blocking thread pool, inside a low-latency thread pool, or elsewhere.

    The lock function composes with the innermost lock taking priority. Use of this method does not alter the execution semantics of other effects composed with this one, making it easy to compositionally reason about where effects are running.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use onExecutor

  21. final def lockExecutionContext(ec: ⇒ ExecutionContext)(implicit trace: ZTraceElement): ZIO[R, E, A]

    Permalink

    Executes the effect on the specified ExecutionContext and then shifts back to the default one.

    Executes the effect on the specified ExecutionContext and then shifts back to the default one.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use onExecutionContext

  22. final def mapEffect[B](f: (A) ⇒ B)(implicit ev: IsSubtypeOfError[E, Throwable], trace: ZTraceElement): RIO[R, B]

    Permalink

    Returns an effect whose success is mapped by the specified side effecting f function, translating any thrown exceptions into typed failed effects.

    Returns an effect whose success is mapped by the specified side effecting f function, translating any thrown exceptions into typed failed effects.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use mapAttempt

  23. final def on(ec: ⇒ ExecutionContext)(implicit trace: ZTraceElement): ZIO[R, E, A]

    Permalink

    Executes the effect on the specified ExecutionContext and then shifts back to the default one.

    Executes the effect on the specified ExecutionContext and then shifts back to the default one.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use onExecutionContext

  24. final def optional[E1](implicit ev: IsSubtypeOfError[E, Option[E1]], trace: ZTraceElement): ZIO[R, E1, Option[A]]

    Permalink

    Converts an option on errors into an option on values.

    Converts an option on errors into an option on values.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use unsome

  25. final def provideCustomLayer[E1 >: E, R1](layer: ⇒ ZLayer[ZEnv, E1, R1])(implicit ev: <:<[ZEnv with R1, R], tagged: zio.Tag[R1], trace: ZTraceElement): ZIO[ZEnv, E1, A]

    Permalink

    Provides the part of the environment that is not part of the ZEnv, leaving an effect that only depends on the ZEnv.

    Provides the part of the environment that is not part of the ZEnv, leaving an effect that only depends on the ZEnv.

    val zio: ZIO[ZEnv with Logging, Nothing, Unit] = ???
    
    val loggingLayer: ZLayer[Any, Nothing, Logging] = ???
    
    val zio2 = zio.provideCustomLayer(loggingLayer)
    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use provideCustom

  26. final def provideLayer[E1 >: E, R0, R1](layer: ⇒ ZLayer[R0, E1, R1])(implicit ev: <:<[R1, R], trace: ZTraceElement): ZIO[R0, E1, A]

    Permalink

    Provides a layer to the ZIO effect, which translates it to another level.

    Provides a layer to the ZIO effect, which translates it to another level.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use provide

  27. final def provideSomeLayer[R0]: ProvideSome[R0, R, E, A]

    Permalink

    Splits the environment into two parts, providing one part using the specified layer and leaving the remainder R0.

    Splits the environment into two parts, providing one part using the specified layer and leaving the remainder R0.

    val zio: ZIO[Clock with Random, Nothing, Unit] = ???
    
    val clockLayer: ZLayer[Any, Nothing, Clock] = ???
    
    val zio2 = zio.provideSomeLayer[Random](clockLayer)
    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use provideSome

  28. final def rejectM[R1 <: R, E1 >: E](pf: PartialFunction[A, ZIO[R1, E1, E1]])(implicit trace: ZTraceElement): ZIO[R1, E1, A]

    Permalink

    Continue with the returned computation if the PartialFunction matches, translating the successful match into a failure, otherwise continue with our held value.

    Continue with the returned computation if the PartialFunction matches, translating the successful match into a failure, otherwise continue with our held value.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use rejectZIO

  29. final def repeatUntilM[R1 <: R](f: (A) ⇒ URIO[R1, Boolean])(implicit trace: ZTraceElement): ZIO[R1, E, A]

    Permalink

    Repeats this effect until its value satisfies the specified effectful predicate or until the first failure.

    Repeats this effect until its value satisfies the specified effectful predicate or until the first failure.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use repeatUntilZIO

  30. final def repeatWhileM[R1 <: R](f: (A) ⇒ URIO[R1, Boolean])(implicit trace: ZTraceElement): ZIO[R1, E, A]

    Permalink

    Repeats this effect while its value satisfies the specified effectful predicate or until the first failure.

    Repeats this effect while its value satisfies the specified effectful predicate or until the first failure.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use repeatWhileZIO

  31. final def replicateM(n: ⇒ Int)(implicit trace: ZTraceElement): ZIO[R, E, Iterable[A]]

    Permalink

    Performs this effect the specified number of times and collects the results.

    Performs this effect the specified number of times and collects the results.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use replicateZIO

  32. final def replicateM_(n: ⇒ Int)(implicit trace: ZTraceElement): ZIO[R, E, Unit]

    Permalink

    Performs this effect the specified number of times, discarding the results.

    Performs this effect the specified number of times, discarding the results.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use replicateZIODiscard

  33. final def retryUntilM[R1 <: R](f: (E) ⇒ URIO[R1, Boolean])(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R1, E, A]

    Permalink

    Retries this effect until its error satisfies the specified effectful predicate.

    Retries this effect until its error satisfies the specified effectful predicate.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use retryUntilZIO

  34. final def retryWhileM[R1 <: R](f: (E) ⇒ URIO[R1, Boolean])(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R1, E, A]

    Permalink

    Retries this effect while its error satisfies the specified effectful predicate.

    Retries this effect while its error satisfies the specified effectful predicate.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use retryWhileZIO

  35. final def run(implicit trace: ZTraceElement): URIO[R, Exit[E, A]]

    Permalink

    Returns an effect that semantically runs the effect on a fiber, producing an zio.Exit for the completion value of the fiber.

    Returns an effect that semantically runs the effect on a fiber, producing an zio.Exit for the completion value of the fiber.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use exit

  36. final def someOrElseM[B, R1 <: R, E1 >: E](default: ⇒ ZIO[R1, E1, B])(implicit ev: IsSubtypeOfOutput[A, Option[B]], trace: ZTraceElement): ZIO[R1, E1, B]

    Permalink

    Extracts the optional value, or executes the effect 'default'.

    Extracts the optional value, or executes the effect 'default'.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use someOrElseZIO

  37. final def tapCause[R1 <: R, E1 >: E](f: (Cause[E]) ⇒ ZIO[R1, E1, Any])(implicit trace: ZTraceElement): ZIO[R1, E1, A]

    Permalink

    Returns an effect that effectually "peeks" at the cause of the failure of this effect.

    Returns an effect that effectually "peeks" at the cause of the failure of this effect.

    readFile("data.json").tapCause(logCause(_))
    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use tapErrorCause

  38. final def timeoutHalt[E1 >: E](cause: ⇒ Cause[E1])(d: ⇒ zio.Duration)(implicit trace: ZTraceElement): ZIO[R with Clock, E1, A]

    Permalink

    The same as timeout, but instead of producing a None in the event of timeout, it will produce the specified failure.

    The same as timeout, but instead of producing a None in the event of timeout, it will produce the specified failure.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use timeoutFailCause

  39. final def to[E1 >: E, A1 >: A](p: ⇒ Promise[E1, A1])(implicit trace: ZTraceElement): URIO[R, Boolean]

    Permalink

    Returns an effect that keeps or breaks a promise based on the result of this effect.

    Returns an effect that keeps or breaks a promise based on the result of this effect. Synchronizes interruption, so if this effect is interrupted, the specified promise will be interrupted, too.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use intoPromise

  40. final def toLayerMany[B](implicit ev: <:<[A, ZEnvironment[B]], trace: ZTraceElement): ZLayer[R, E, B]

    Permalink

    Constructs a layer from this effect, which must return one or more services.

    Constructs a layer from this effect, which must return one or more services.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use toLayerEnvironment

  41. final def toManaged_(implicit trace: ZTraceElement): ZManaged[R, E, A]

    Permalink

    Converts this ZIO to zio.ZManaged with no release action.

    Converts this ZIO to zio.ZManaged with no release action. It will be performed interruptibly.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use toManaged

  42. final def unlessM[R1 <: R, E1 >: E](p: ⇒ ZIO[R1, E1, Boolean])(implicit trace: ZTraceElement): ZIO[R1, E1, Option[A]]

    Permalink

    The moral equivalent of if (!p) exp when p has side-effects

    The moral equivalent of if (!p) exp when p has side-effects

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use unlessZIO

  43. final def unoption[E1](implicit ev: IsSubtypeOfError[E, Option[E1]], trace: ZTraceElement): ZIO[R, E1, Option[A]]

    Permalink

    Converts an option on errors into an option on values.

    Converts an option on errors into an option on values.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use unsome

  44. final def whenM[R1 <: R, E1 >: E](p: ⇒ ZIO[R1, E1, Boolean])(implicit trace: ZTraceElement): ZIO[R1, E1, Option[A]]

    Permalink

    The moral equivalent of if (p) exp when p has side-effects

    The moral equivalent of if (p) exp when p has side-effects

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use whenZIO

Inherited from ZIOVersionSpecific[R, E, A]

Inherited from ZIOPlatformSpecific[R, E, A]

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped