ZIO

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

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.

Companion:
object
class Object
trait Matchable
class Any
ZIO[R, E, A]

Value members

Abstract methods

def tag: Int

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

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

Concrete methods

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

A symbolic alias for orDie.

A symbolic alias for orDie.

final def &&[R1 <: R, E1 >: E](that: => ZIO[R1, E1, Boolean])(implicit ev: A <:< Boolean): ZIO[R1, E1, Boolean]

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.

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.

final def &&&[R1 <: R, E1 >: E, B](that: ZIO[R1, E1, B]): ZIO[R1, E1, (A, B)]

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.

final def &>[R1 <: R, E1 >: E, B](that: ZIO[R1, E1, B]): ZIO[R1, E1, B]

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.

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.

final def ***[R1, E1 >: E, B](that: ZIO[R1, E1, B]): ZIO[(R, R1), E1, (A, B)]

Splits the environment, providing the first part to this effect and the second part to that effect.

Splits the environment, providing the first part to this effect and the second part to that effect.

final def *>[R1 <: R, E1 >: E, B](that: => ZIO[R1, E1, B]): ZIO[R1, E1, B]

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

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

final def +++[R1, B, E1 >: E](that: ZIO[R1, E1, B]): ZIO[Either[R, R1], E1, Either[A, B]]

Depending on provided environment, returns either this one or the other effect lifted in Left or Right, respectively.

Depending on provided environment, returns either this one or the other effect lifted in Left or Right, respectively.

final def <&[R1 <: R, E1 >: E, B](that: ZIO[R1, E1, B]): ZIO[R1, E1, A]

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.

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.

final def <&>[R1 <: R, E1 >: E, B](that: ZIO[R1, E1, B]): ZIO[R1, E1, (A, B)]

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.

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.

final def <*[R1 <: R, E1 >: E, B](that: => ZIO[R1, E1, B]): ZIO[R1, E1, A]

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

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

final def <*>[R1 <: R, E1 >: E, B](that: ZIO[R1, E1, B]): ZIO[R1, E1, (A, B)]

Alias for &&&.

Alias for &&&.

final def <+>[R1 <: R, E1, B](that: => ZIO[R1, E1, B])(implicit ev: CanFail[E]): ZIO[R1, E1, Either[A, B]]

A symbolic alias for orElseEither.

A symbolic alias for orElseEither.

final def <<<[R1, E1 >: E](that: ZIO[R1, E1, R]): ZIO[R1, E1, A]

Operator alias for compose.

Operator alias for compose.

final def <>[R1 <: R, E2, A1 >: A](that: => ZIO[R1, E2, A1])(implicit ev: CanFail[E]): ZIO[R1, E2, A1]

Operator alias for orElse.

Operator alias for orElse.

final def <|>[R1 <: R, E1 >: E, B](that: ZIO[R1, E1, B]): ZIO[R1, E1, Either[A, B]]

A symbolic alias for raceEither.

A symbolic alias for raceEither.

final def >>=[R1 <: R, E1 >: E, B](k: A => ZIO[R1, E1, B]): ZIO[R1, E1, B]

Alias for flatMap.

Alias for flatMap.

val parsed = readFile("foo.txt") >>= parseFile
final def >>>[E1 >: E, B](that: ZIO[A, E1, B]): ZIO[R, E1, B]

Operator alias for andThen.

Operator alias for andThen.

final def absolve[E1 >: E, B](implicit ev: A <:< Either[E1, B]): ZIO[R, E1, B]

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

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

final def absorb(implicit ev: E <:< Throwable): RIO[R, A]

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

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

final def absorbWith(f: E => Throwable): RIO[R, A]

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

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

final def andThen[E1 >: E, B](that: ZIO[A, E1, B]): ZIO[R, E1, B]
final def as[B](b: => B): ZIO[R, E, B]

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

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

final def asService[A1 >: A : Tag]: ZIO[R, E, Has[A1]]

Maps the success value of this effect to a service.

Maps the success value of this effect to a service.

final def asSome: ZIO[R, E, Option[A]]

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

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

final def asSomeError: ZIO[R, Option[E], A]

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

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

final def awaitAllChildren: ZIO[R, E, A]

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.

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.

final def bracket[R1 <: R, E1 >: E, B](release: A => URIO[R1, Any], use: A => ZIO[R1, E1, B]): ZIO[R1, E1, B]

Shorthand for the uncurried version of ZIO.bracket.

Shorthand for the uncurried version of ZIO.bracket.

final def bracket: BracketAcquire[R, E, A]

Shorthand for the curried version of ZIO.bracket.

Shorthand for the curried version of ZIO.bracket.

def bracketAuto[R1 <: R, E1 >: E, B](use: A => ZIO[R1, E1, B]): ZIO[R1, E1, B]
Implicitly added by ZIOAutoCloseableOps

Like bracket, safely wraps a use and release of a resource. This resource will get automatically closed, because it implements AutoCloseable.

Like bracket, safely wraps a use and release of a resource. This resource will get automatically closed, because it implements AutoCloseable.

final def bracketExit[R1 <: R, E1 >: E, B](release: (A, Exit[E1, B]) => URIO[R1, Any], use: A => ZIO[R1, E1, B]): ZIO[R1, E1, B]

Shorthand for the uncurried version of ZIO.bracketExit.

Shorthand for the uncurried version of ZIO.bracketExit.

final def bracketExit: BracketExitAcquire[R, E, A]

Shorthand for the curried version of ZIO.bracketExit.

Shorthand for the curried version of ZIO.bracketExit.

final def bracketOnError[R1 <: R, E1 >: E, B](release: A => URIO[R1, Any])(use: A => ZIO[R1, E1, B]): ZIO[R1, E1, B]

Executes the release effect only if there was an error.

Executes the release effect only if there was an error.

final def bracket_[R1 <: R, E1 >: E]: BracketAcquire_[R1, E1]

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.

final def bracket_[R1 <: R, E1 >: E, B](release: URIO[R1, Any], use: ZIO[R1, E1, B]): ZIO[R1, E1, B]

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

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

final def cached(timeToLive: Duration): ZIO[R & Clock, Nothing, IO[E, A]]

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

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

final def cachedInvalidate(timeToLive: Duration): ZIO[R & Clock, Nothing, (IO[E, A], UIO[Unit])]

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.

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.

final def catchAll[R1 <: R, E2, A1 >: A](h: E => ZIO[R1, E2, A1])(implicit ev: CanFail[E]): ZIO[R1, E2, A1]

Recovers from all errors.

Recovers from all errors.

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

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

final def catchAllDefect[R1 <: R, E1 >: E, A1 >: A](h: Throwable => ZIO[R1, E1, A1]): ZIO[R1, E1, A1]

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.

final def catchAllTrace[R1 <: R, E2, A1 >: A](h: (E, Option[ZTrace]) => ZIO[R1, E2, A1])(implicit ev: CanFail[E]): ZIO[R1, E2, A1]

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

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

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

Recovers from all NonFatal Throwables.

Recovers from all NonFatal Throwables.

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

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")
}
final def catchSomeCause[R1 <: R, E1 >: E, A1 >: A](pf: PartialFunction[Cause[E], ZIO[R1, E1, A1]]): ZIO[R1, E1, A1]

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")
}
final def catchSomeDefect[R1 <: R, E1 >: E, A1 >: A](pf: PartialFunction[Throwable, ZIO[R1, E1, A1]]): ZIO[R1, E1, A1]

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.

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

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

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

final def cause: URIO[R, Cause[E]]

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

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

final def collect[E1 >: E, B](e: => E1)(pf: PartialFunction[A, B]): ZIO[R, E1, B]

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

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

final def collectM[R1 <: R, E1 >: E, B](e: => E1)(pf: PartialFunction[A, ZIO[R1, E1, B]]): ZIO[R1, E1, B]

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.

final def compose[R1, E1 >: E](that: ZIO[R1, E1, R]): ZIO[R1, E1, A]
final def debug: ZIO[R, E, A]

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

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

final def debug(prefix: => String): ZIO[R, E, A]

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

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

final def delay(duration: Duration): ZIO[R & Clock, E, A]

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

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

final def disconnect: ZIO[R, E, A]

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 a bracketed 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.

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

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.

final def ensuring[R1 <: R](finalizer: URIO[R1, Any]): ZIO[R1, E, A]

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#bracket.

final def ensuringChild[R1 <: R](f: Fiber[Any, Iterable[Any]] => ZIO[R1, Nothing, Any]): ZIO[R1, E, A]

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.

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.

def ensuringChildren[R1 <: R](children: Chunk[Runtime[Any, Any]] => ZIO[R1, Nothing, Any]): ZIO[R1, E, A]

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

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

final def eventually(implicit ev: CanFail[E]): URIO[R, A]

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

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

final def exitCode: URIO[R & Console, ExitCode]

Maps this effect to the default exit codes.

Maps this effect to the default exit codes.

final def filterOrDie(p: A => Boolean)(t: => Throwable): ZIO[R, E, A]

Dies with specified Throwable if the predicate fails.

Dies with specified Throwable if the predicate fails.

final def filterOrDieMessage(p: A => Boolean)(message: => String): ZIO[R, E, A]

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

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

final def filterOrElse[R1 <: R, E1 >: E, A1 >: A](p: A => Boolean)(f: A => ZIO[R1, E1, A1]): ZIO[R1, E1, A1]

Applies f if the predicate fails.

Applies f if the predicate fails.

final def filterOrElse_[R1 <: R, E1 >: E, A1 >: A](p: A => Boolean)(zio: => ZIO[R1, E1, A1]): ZIO[R1, E1, A1]

Supplies zio if the predicate fails.

Supplies zio if the predicate fails.

final def filterOrFail[E1 >: E](p: A => Boolean)(e: => E1): ZIO[R, E1, A]

Fails with e if the predicate fails.

Fails with e if the predicate fails.

final def firstSuccessOf[R1 <: R, E1 >: E, A1 >: A](rest: Iterable[ZIO[R1, E1, A1]]): ZIO[R1, E1, A1]

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.

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.

def flatMap[R1 <: R, E1 >: E, B](k: A => ZIO[R1, E1, B]): ZIO[R1, E1, B]

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))
final def flatMapError[R1 <: R, E2](f: E => URIO[R1, E2])(implicit ev: CanFail[E]): ZIO[R1, E2, A]

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))
final def flatten[R1 <: R, E1 >: E, B](implicit ev1: A <:< ZIO[R1, E1, B]): ZIO[R1, E1, B]

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.

final def flattenErrorOption[E1, E2 <: E1](default: => E2)(implicit ev: E <:< Option[E1]): ZIO[R, E1, A]

Unwraps the optional error, defaulting to the provided value.

Unwraps the optional error, defaulting to the provided value.

final def flip: ZIO[R, A, E]

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

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

final def flipWith[R1, A1, E1](f: ZIO[R, A, E] => ZIO[R1, A1, E1]): ZIO[R1, E1, A1]

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

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

final def fold[B](failure: E => B, success: A => B)(implicit ev: CanFail[E]): URIO[R, B]

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.

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.

final def foldCause[B](failure: Cause[E] => B, success: A => B): URIO[R, B]

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.

final def foldCauseM[R1 <: R, E2, B](failure: Cause[E] => ZIO[R1, E2, B], success: A => ZIO[R1, E2, B]): ZIO[R1, E2, B]

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

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

final def foldM[R1 <: R, E2, B](failure: E => ZIO[R1, E2, B], success: A => ZIO[R1, E2, B])(implicit ev: CanFail[E]): ZIO[R1, E2, B]

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.

final def foldTraceM[R1 <: R, E2, B](failure: (E, Option[ZTrace]) => ZIO[R1, E2, B], success: A => ZIO[R1, E2, B])(implicit ev: CanFail[E]): ZIO[R1, E2, B]

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

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

final def forever: ZIO[R, E, Nothing]

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

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

final def fork: URIO[R, Runtime[E, A]]

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
final def forkAs(name: String): URIO[R, Runtime[E, A]]

Forks the effect into a new independent fiber, with the specified name.

Forks the effect into a new independent fiber, with the specified name.

final def forkDaemon: URIO[R, Runtime[E, A]]

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.

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.

final def forkIn(scope: ZScope[Exit[Any, Any]]): URIO[R, Runtime[E, A]]
final def forkInternal: ZIO[R, Nothing, Runtime[E, A]]

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

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

final def forkManaged: ZManaged[R, Nothing, Runtime[E, A]]

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.

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.

final def forkOn(ec: ExecutionContext): ZIO[R, E, Runtime[E, A]]

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

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

final def forkWithErrorHandler(handler: E => UIO[Unit]): URIO[R, Runtime[E, A]]

Like fork but handles an error with the provided handler.

Like fork but handles an error with the provided handler.

final def get[B](implicit ev1: E <:< Nothing, ev2: A <:< Option[B]): ZIO[R, Option[Nothing], B]

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.

final def head[B](implicit ev: A <:< List[B]): ZIO[R, Option[E], B]

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.

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.

final def ignore: URIO[R, Unit]

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

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

final def in(scope: ZScope[Any]): ZIO[R, E, A]

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.

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.

final def interruptAllChildren: ZIO[R, E, A]

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

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

final def interruptStatus(flag: InterruptStatus): ZIO[R, E, A]

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.

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.

final def interruptible: ZIO[R, E, A]

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.

final def isFailure: URIO[R, Boolean]

Returns whether this effect is a failure.

Returns whether this effect is a failure.

final def isSuccess: URIO[R, Boolean]

Returns whether this effect is a success.

Returns whether this effect is a success.

final def join[R1, E1 >: E, A1 >: A](that: ZIO[R1, E1, A1]): ZIO[Either[R, R1], E1, A1]

Joins this effect with the specified effect.

Joins this effect with the specified effect.

final def left[B, C](implicit ev: A <:< Either[B, C]): ZIO[R, Option[E], B]

Returns a successful effect if the value is Left, or fails with the error None.

Returns a successful effect if the value is Left, or fails with the error None.

final def leftOrFail[B, C, E1 >: E](e: => E1)(implicit ev: A <:< Either[B, C]): ZIO[R, E1, B]

Returns a successful effect if the value is Left, or fails with the error e.

Returns a successful effect if the value is Left, or fails with the error e.

final def leftOrFailException[B, C, E1 >: NoSuchElementException](implicit ev: A <:< Either[B, C], ev2: E <:< E1): ZIO[R, E1, B]

Returns a successful effect if the value is Left, or fails with a java.util.NoSuchElementException.

Returns a successful effect if the value is Left, or fails with a java.util.NoSuchElementException.

final def leftOrFailWith[B, C, E1 >: E](e: C => E1)(implicit ev: A <:< Either[B, C]): ZIO[R, E1, B]

Returns a successful effect if the value is Left, or fails with the given error function 'e'.

Returns a successful effect if the value is Left, or fails with the given error function 'e'.

final def lock(executor: Executor): ZIO[R, E, A]

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.

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.

def map[B](f: A => B): ZIO[R, E, B]

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

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

final def mapBoth[E2, B](f: E => E2, g: A => B)(implicit ev: CanFail[E]): ZIO[R, E2, B]

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.

final def mapEffect[B](f: A => B)(implicit ev: E <:< Throwable): RIO[R, B]

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.

final def mapError[E2](f: E => E2)(implicit ev: CanFail[E]): ZIO[R, E2, A]

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.

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.

final def mapErrorCause[E2](h: Cause[E] => Cause[E2]): ZIO[R, E2, A]

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.

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

final def memoize: UIO[ZIO[R, E, A]]

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

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

final def merge[A1 >: A](implicit ev1: E <:< A1, ev2: CanFail[E]): URIO[R, A1]

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

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

final def negate(implicit ev: A <:< Boolean): ZIO[R, E, Boolean]

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

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

final def none[B](implicit ev: A <:< Option[B]): ZIO[R, Option[E], Unit]

Requires the option produced by this value to be None.

Requires the option produced by this value to be None.

final def on(ec: ExecutionContext): ZIO[R, E, A]

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.

final def onError[R1 <: R](cleanup: Cause[E] => URIO[R1, Any]): ZIO[R1, E, A]

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

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

final def onExit[R1 <: R](cleanup: Exit[E, A] => URIO[R1, Any]): ZIO[R1, E, A]

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

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

final def onFirst[R1 <: R]: ZIO[R1, E, (A, R1)]

Propagates the success value to the first element of a tuple, but passes the effect input R along unmodified as the second element of the tuple.

Propagates the success value to the first element of a tuple, but passes the effect input R along unmodified as the second element of the tuple.

final def onInterrupt[R1 <: R](cleanup: URIO[R1, Any]): ZIO[R1, E, A]

Runs the specified effect if this effect is interrupted.

Runs the specified effect if this effect is interrupted.

final def onInterrupt[R1 <: R](cleanup: Set[Id] => URIO[R1, Any]): ZIO[R1, E, A]

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

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

final def onLeft[C]: ZIO[Either[R, C], E, Either[A, C]]

Returns this effect if environment is on the left, otherwise returns whatever is on the right unmodified. Note that the result is lifted in either.

Returns this effect if environment is on the left, otherwise returns whatever is on the right unmodified. Note that the result is lifted in either.

final def onRight[C]: ZIO[Either[C, R], E, Either[C, A]]

Returns this effect if environment is on the right, otherwise returns whatever is on the left unmodified. Note that the result is lifted in either.

Returns this effect if environment is on the right, otherwise returns whatever is on the left unmodified. Note that the result is lifted in either.

final def onSecond[R1 <: R]: ZIO[R1, E, (R1, A)]

Propagates the success value to the second element of a tuple, but passes the effect input R along unmodified as the first element of the tuple.

Propagates the success value to the second element of a tuple, but passes the effect input R along unmodified as the first element of the tuple.

final def onTermination[R1 <: R](cleanup: Cause[Nothing] => URIO[R1, Any]): ZIO[R1, E, A]

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

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

final def once: UIO[ZIO[R, E, Unit]]

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

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

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

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

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

final def optional[E1](implicit ev: E <:< Option[E1]): ZIO[R, E1, Option[A]]

Converts an option on errors into an option on values.

Converts an option on errors into an option on values.

final def orDie(implicit ev1: E <:< Throwable, ev2: CanFail[E]): URIO[R, A]

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

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

final def orDieWith(f: E => Throwable)(implicit ev: CanFail[E]): URIO[R, A]

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

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

final def orElse[R1 <: R, E2, A1 >: A](that: => ZIO[R1, E2, A1])(implicit ev: CanFail[E]): ZIO[R1, E2, A1]

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

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

final def orElseEither[R1 <: R, E2, B](that: => ZIO[R1, E2, B])(implicit ev: CanFail[E]): ZIO[R1, E2, Either[A, B]]

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.

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.

final def orElseFail[E1](e1: => E1)(implicit ev: CanFail[E]): ZIO[R, E1, A]

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

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

final def orElseOptional[R1 <: R, E1, A1 >: A](that: => ZIO[R1, Option[E1], A1])(implicit ev: E <:< Option[E1]): ZIO[R1, Option[E1], A1]

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.

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.

final def orElseSucceed[A1 >: A](a1: => A1)(implicit ev: CanFail[E]): URIO[R, A1]

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

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

final def overrideForkScope(scope: ZScope[Exit[Any, Any]]): ZIO[R, E, A]

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

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

final def parallelErrors[E1 >: E]: ZIO[R, ::[E1], A]

Exposes all parallel errors in a single call

Exposes all parallel errors in a single call

final def provide(r: R)(implicit ev: NeedsEnv[R]): IO[E, A]

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

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

final def provideCustomLayer[E1 >: E, R1 <: Has[_]](layer: ZLayer[ZEnv, E1, R1])(implicit ev: ZEnv & R1 <:< R, tagged: Tag[R1]): ZIO[ZEnv, E1, A]

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 loggingLayer: ZLayer[Any, Nothing, Logging] = ???

val zio: ZIO[ZEnv with Logging, Nothing, Unit] = ???

val zio2 = zio.provideCustomLayer(loggingLayer)
final def provideLayer[E1 >: E, R0, R1](layer: ZLayer[R0, E1, R1])(implicit ev1: R1 <:< R, ev2: NeedsEnv[R]): ZIO[R0, E1, A]

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.

final def provideSome[R0](f: R0 => R)(implicit ev: NeedsEnv[R]): ZIO[R0, E, A]

Provides some of the environment required to run this effect, leaving the remainder R0.

Provides some of the environment required to run this effect, leaving the remainder R0.

If your environment has the type Has[_], please see zio.ZIO.provideSomeLayer

val effect: ZIO[Console with Logging, Nothing, Unit] = ???

effect.provideSome[Console](env =>
 new Console with Logging {
   val console = env.console
   val logging = new Logging.Service[Any] {
     def log(line: String) = console.putStrLn(line)
   }
 }
)
final def provideSomeLayer[R0 <: Has[_]]: ProvideSomeLayer[R0, R, E, A]

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 clockLayer: ZLayer[Any, Nothing, Clock] = ???

val zio: ZIO[Clock with Random, Nothing, Unit] = ???

val zio2 = zio.provideSomeLayer[Random](clockLayer)
final def race[R1 <: R, E1 >: E, A1 >: A](that: ZIO[R1, E1, A1]): ZIO[R1, E1, A1]

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.

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.

final def raceAll[R1 <: R, E1 >: E, A1 >: A](ios: Iterable[ZIO[R1, E1, A1]]): ZIO[R1, E1, A1]

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

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

final def raceEither[R1 <: R, E1 >: E, B](that: ZIO[R1, E1, B]): ZIO[R1, E1, Either[A, B]]

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.

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.

final def raceFirst[R1 <: R, E1 >: E, A1 >: A](that: ZIO[R1, E1, A1]): ZIO[R1, E1, A1]

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.

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.

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]]]): ZIO[R1, E2, C]

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.

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.

final def refailWithTrace: ZIO[R, E, A]

Attach a wrapping trace pointing to this location in case of error.

Attach a wrapping trace pointing to this location in case of error.

Useful when joining fibers to make the resulting trace mention the join point, otherwise only the traces of joined fibers are included.

 for {
   badFiber <- UIO(1 / 0).fork
   _ <- badFiber.join.refailWithTrace
 } yield ()
final def refineOrDie[E1](pf: PartialFunction[E, E1])(implicit ev1: E <:< Throwable, ev2: CanFail[E]): ZIO[R, E1, A]

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

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

final def refineOrDieWith[E1](pf: PartialFunction[E, E1])(f: E => Throwable)(implicit ev: CanFail[E]): ZIO[R, E1, A]

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

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

def refineToOrDie[E1 <: E : ClassTag](implicit evidence$17: ClassTag[E1], ev: CanFail[E]): ZIO[R, E1, A]
Implicitly added by ZioRefineToOrDieOps

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

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

final def reject[E1 >: E](pf: PartialFunction[A, E1]): ZIO[R, E1, A]

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

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

final def rejectM[R1 <: R, E1 >: E](pf: PartialFunction[A, ZIO[R1, E1, E1]]): ZIO[R1, E1, A]

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.

final def repeat[R1 <: R, B](schedule: Schedule[R1, A, B]): ZIO[R1 & Clock, E, B]

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.

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.

final def repeatN(n: Int): ZIO[R, E, A]

Repeats this effect the specified number of times.

Repeats this effect the specified number of times.

final def repeatOrElse[R1 <: R, E2, B](schedule: Schedule[R1, A, B], orElse: (E, Option[B]) => ZIO[R1, E2, B]): ZIO[R1 & Clock, E2, B]

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.

final def repeatOrElseEither[R1 <: R, B, E2, C](schedule: Schedule[R1, A, B], orElse: (E, Option[B]) => ZIO[R1, E2, C]): ZIO[R1 & Clock, E2, Either[C, B]]

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.

final def repeatUntil(f: A => Boolean): ZIO[R, E, A]

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

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

final def repeatUntilEquals[A1 >: A](a: => A1): ZIO[R, E, A1]

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

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

final def repeatUntilM[R1 <: R](f: A => URIO[R1, Boolean]): ZIO[R1, E, A]

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.

final def repeatWhile(f: A => Boolean): ZIO[R, E, A]

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

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

final def repeatWhileEquals[A1 >: A](a: => A1): ZIO[R, E, A1]

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

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

final def repeatWhileM[R1 <: R](f: A => URIO[R1, Boolean]): ZIO[R1, E, A]

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.

final def replicateM(n: Int): ZIO[R, E, Iterable[A]]

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

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

final def replicateM_(n: Int): ZIO[R, E, Unit]

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

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

final def resetForkScope: ZIO[R, E, A]

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

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

final def resurrect(implicit ev1: E <:< Throwable): RIO[R, A]

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

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
final def retry[R1 <: R, S](policy: Schedule[R1, E, S])(implicit ev: CanFail[E]): ZIO[R1 & Clock, E, A]

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".

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".

final def retryN(n: Int)(implicit ev: CanFail[E]): ZIO[R, E, A]

Retries this effect the specified number of times.

Retries this effect the specified number of times.

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]): ZIO[R1 & Clock, E1, A1]

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.

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.

final def retryOrElseEither[R1 <: R, Out, E1, B](schedule: Schedule[R1, E, Out], orElse: (E, Out) => ZIO[R1, E1, B])(implicit ev: CanFail[E]): ZIO[R1 & Clock, E1, Either[B, A]]

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.

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.

final def retryUntil(f: E => Boolean)(implicit ev: CanFail[E]): ZIO[R, E, A]

Retries this effect until its error satisfies the specified predicate.

Retries this effect until its error satisfies the specified predicate.

final def retryUntilEquals[E1 >: E](e: => E1)(implicit ev: CanFail[E1]): ZIO[R, E1, A]

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

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

final def retryUntilM[R1 <: R](f: E => URIO[R1, Boolean])(implicit ev: CanFail[E]): ZIO[R1, E, A]

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

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

final def retryWhile(f: E => Boolean)(implicit ev: CanFail[E]): ZIO[R, E, A]

Retries this effect while its error satisfies the specified predicate.

Retries this effect while its error satisfies the specified predicate.

final def retryWhileEquals[E1 >: E](e: => E1)(implicit ev: CanFail[E1]): ZIO[R, E1, A]

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

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

final def retryWhileM[R1 <: R](f: E => URIO[R1, Boolean])(implicit ev: CanFail[E]): ZIO[R1, E, A]

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

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

final def right[B, C](implicit ev: A <:< Either[B, C]): ZIO[R, Option[E], C]

Returns a successful effect if the value is Right, or fails with the error None.

Returns a successful effect if the value is Right, or fails with the error None.

final def rightOrFail[B, C, E1 >: E](e: => E1)(implicit ev: A <:< Either[B, C]): ZIO[R, E1, C]

Returns a successful effect if the value is Right, or fails with the given error 'e'.

Returns a successful effect if the value is Right, or fails with the given error 'e'.

final def rightOrFailException[B, C, E1 >: NoSuchElementException](implicit ev: A <:< Either[B, C], ev2: E <:< E1): ZIO[R, E1, C]

Returns a successful effect if the value is Right, or fails with a java.util.NoSuchElementException.

Returns a successful effect if the value is Right, or fails with a java.util.NoSuchElementException.

final def rightOrFailWith[B, C, E1 >: E](e: B => E1)(implicit ev: A <:< Either[B, C]): ZIO[R, E1, C]

Returns a successful effect if the value is Right, or fails with the given error function 'e'.

Returns a successful effect if the value is Right, or fails with the given error function 'e'.

final def run: URIO[R, Exit[E, A]]

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.

final def sandbox: ZIO[R, Cause[E], A]

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.effectTotal(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.halt(cause)
 }
final def sandboxWith[R1 <: R, E2, B](f: ZIO[R1, Cause[E], A] => ZIO[R1, Cause[E2], B]): ZIO[R1, E2, B]

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

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.effectTotal(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

final def schedule[R1 <: R, B](schedule: Schedule[R1, Any, B]): ZIO[R1 & Clock, E, B]

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.

final def scheduleFrom[R1 <: R, A1 >: A, B](a: A1)(schedule: Schedule[R1, A1, B]): ZIO[R1 & Clock, E, B]

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

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

final def some[B](implicit ev: A <:< Option[B]): ZIO[R, Option[E], B]

Converts an option on values into an option on errors.

Converts an option on values into an option on errors.

final def someOrElse[B](default: => B)(implicit ev: A <:< Option[B]): ZIO[R, E, B]

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

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

final def someOrElseM[B, R1 <: R, E1 >: E](default: ZIO[R1, E1, B])(implicit ev: A <:< Option[B]): ZIO[R1, E1, B]

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

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

final def someOrFail[B, E1 >: E](e: => E1)(implicit ev: A <:< Option[B]): ZIO[R, E1, B]

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

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

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

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

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

final def summarized[R1 <: R, E1 >: E, B, C](summary: ZIO[R1, E1, B])(f: (B, B) => C): ZIO[R1, E1, (C, A)]

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.

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.

final def supervised(supervisor: Supervisor[Any]): ZIO[R, E, A]

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

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

final def tap[R1 <: R, E1 >: E](f: A => ZIO[R1, E1, Any]): ZIO[R1, E1, A]

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(putStrLn)
final def tapBoth[R1 <: R, E1 >: E](f: E => ZIO[R1, E1, Any], g: A => ZIO[R1, E1, Any])(implicit ev: CanFail[E]): ZIO[R1, E1, A]

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(_))
final def tapCause[R1 <: R, E1 >: E](f: Cause[E] => ZIO[R1, E1, Any]): ZIO[R1, E1, A]

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(_))
final def tapDefect[R1 <: R, E1 >: E](f: Cause[Nothing] => ZIO[R1, E1, Any]): ZIO[R1, E1, A]

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

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

final def tapEither[R1 <: R, E1 >: E](f: Either[E, A] => ZIO[R1, E1, Any])(implicit ev: CanFail[E]): ZIO[R1, E1, A]

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: " + _)))
final def tapError[R1 <: R, E1 >: E](f: E => ZIO[R1, E1, Any])(implicit ev: CanFail[E]): ZIO[R1, E1, A]

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(_))
final def tapErrorTrace[R1 <: R, E1 >: E](f: (E, Option[ZTrace]) => ZIO[R1, E1, Any])(implicit ev: CanFail[E]): ZIO[R1, E1, A]

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

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

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

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.

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)
}
final def timed: ZIO[R & Clock, E, (Duration, A)]

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

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

final def timedWith[R1 <: R, E1 >: E](nanoTime: ZIO[R1, E1, Long]): ZIO[R1, E1, (Duration, A)]

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

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

final def timeout(d: Duration): ZIO[R & Clock, E, Option[A]]

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.

final def timeoutFail[E1 >: E](e: => E1)(d: Duration): ZIO[R & Clock, E1, A]

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

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

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

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)
final def to[E1 >: E, A1 >: A](p: Promise[E1, A1]): URIO[R, Boolean]

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.

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.

final def toFuture(implicit ev2: E <:< Throwable): URIO[R, CancelableFuture[A]]

Converts the effect into a scala.concurrent.Future.

Converts the effect into a scala.concurrent.Future.

final def toFutureWith(f: E => Throwable): URIO[R, CancelableFuture[A]]

Converts the effect into a scala.concurrent.Future.

Converts the effect into a scala.concurrent.Future.

final def toLayer[A1 >: A](implicit ev: Tag[A1]): ZLayer[R, E, Has[A1]]

Constructs a layer from this effect.

Constructs a layer from this effect.

final def toLayerMany[A1 <: Has[_]](implicit ev: A <:< A1): ZLayer[R, E, A1]

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.

def toManaged: ZManaged[R, E, A]
Implicitly added by ZIOAutoCloseableOps

Converts this ZIO value to a ZManaged value. See ZManaged.fromAutoCloseable.

Converts this ZIO value to a ZManaged value. See ZManaged.fromAutoCloseable.

final def toManaged[R1 <: R](release: A => URIO[R1, Any]): ZManaged[R1, E, A]

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

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

def toManagedAuto: ZManaged[R, E, A]
Implicitly added by ZIOAutoCloseableOps

Converts this ZIO value to a ZManaged value. See ZManaged.fromAutoCloseable.

Converts this ZIO value to a ZManaged value. See ZManaged.fromAutoCloseable.

final def toManaged_: ZManaged[R, E, A]

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

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

final def traced: ZIO[R, E, A]

Enables ZIO tracing for this effect. Because this is the default, this operation only has an additional meaning if the effect is located within an untraced section, or the current fiber has been spawned by a parent inside an untraced section.

Enables ZIO tracing for this effect. Because this is the default, this operation only has an additional meaning if the effect is located within an untraced section, or the current fiber has been spawned by a parent inside an untraced section.

final def tracingStatus(flag: TracingStatus): ZIO[R, E, A]

Toggles ZIO tracing support for this effect. If true is used, then the effect will accumulate traces, while if false is used, then tracing is disabled. These changes are compositional, so they only affect regions of the effect.

Toggles ZIO tracing support for this effect. If true is used, then the effect will accumulate traces, while if false is used, then tracing is disabled. These changes are compositional, so they only affect regions of the effect.

final def unary_![R1 <: R, E1 >: E](implicit ev: A <:< Boolean): ZIO[R1, E1, Boolean]

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

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

final def uncause[E1 >: E](implicit ev: A <:< Cause[E1]): ZIO[R, E1, Unit]

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.

final def uninterruptible: ZIO[R, E, A]

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.

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).

final def unit: ZIO[R, E, Unit]

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

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

final def unless(b: => Boolean): ZIO[R, E, Unit]

The moral equivalent of if (!p) exp

The moral equivalent of if (!p) exp

final def unlessM[R1 <: R, E1 >: E](b: ZIO[R1, E1, Boolean]): ZIO[R1, E1, Unit]

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

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

final def unrefine[E1 >: E](pf: PartialFunction[Throwable, E1]): ZIO[R, E1, A]

Takes some fiber failures and converts them into errors.

Takes some fiber failures and converts them into errors.

final def unrefineTo[E1 >: E : ClassTag]: ZIO[R, E1, A]

Takes some fiber failures and converts them into errors.

Takes some fiber failures and converts them into errors.

final def unrefineWith[E1](pf: PartialFunction[Throwable, E1])(f: E => E1): ZIO[R, E1, A]

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

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

final def unsandbox[E1](implicit ev: E <:< Cause[E1]): ZIO[R, E1, A]

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

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

final def untraced: ZIO[R, E, A]

Disables ZIO tracing facilities for the duration of the effect.

Disables ZIO tracing facilities for the duration of the effect.

Note: ZIO tracing is cached, as such after the first iteration it has a negligible effect on performance of hot-spots (Additional hash map lookup per flatMap). As such, using untraced sections is not guaranteed to result in a noticeable performance increase.

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

Updates a service in the environment of this effect.

Updates a service in the environment of this effect.

final def validate[R1 <: R, E1 >: E, B](that: ZIO[R1, E1, B]): ZIO[R1, E1, (A, B)]

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

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

final def validatePar[R1 <: R, E1 >: E, B](that: ZIO[R1, E1, B]): ZIO[R1, E1, (A, B)]

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

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

final def validateWith[R1 <: R, E1 >: E, B, C](that: ZIO[R1, E1, B])(f: (A, B) => C): ZIO[R1, E1, C]

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

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

final def validateWithPar[R1 <: R, E1 >: E, B, C](that: ZIO[R1, E1, B])(f: (A, B) => C): ZIO[R1, E1, C]

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.

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.

final def when(b: => Boolean): ZIO[R, E, Unit]

The moral equivalent of if (p) exp

The moral equivalent of if (p) exp

final def whenM[R1 <: R, E1 >: E](b: ZIO[R1, E1, Boolean]): ZIO[R1, E1, Unit]

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

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

def withFilter(predicate: A => Boolean)(implicit ev: CanFilter[E]): ZIO[R, E, A]
Implicitly added by ZIOWithFilterOps

Enables to check conditions in the value produced by ZIO If the condition is not satisfied, it fails with NoSuchElementException this provide the syntax sugar in for-comprehension: for { (i, j) <- io1 positive <- io2 if positive > 0 } yield ()

Enables to check conditions in the value produced by ZIO If the condition is not satisfied, it fails with NoSuchElementException this provide the syntax sugar in for-comprehension: for { (i, j) <- io1 positive <- io2 if positive > 0 } yield ()

final def zip[R1 <: R, E1 >: E, B](that: ZIO[R1, E1, B]): ZIO[R1, E1, (A, B)]

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

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

final def zipLeft[R1 <: R, E1 >: E, B](that: => ZIO[R1, E1, B]): ZIO[R1, E1, A]

A named alias for <*.

A named alias for <*.

final def zipPar[R1 <: R, E1 >: E, B](that: ZIO[R1, E1, B]): ZIO[R1, E1, (A, B)]

A named alias for <&>.

A named alias for <&>.

final def zipParLeft[R1 <: R, E1 >: E, B](that: ZIO[R1, E1, B]): ZIO[R1, E1, A]

A named alias for <&.

A named alias for <&.

final def zipParRight[R1 <: R, E1 >: E, B](that: ZIO[R1, E1, B]): ZIO[R1, E1, B]

A named alias for &>.

A named alias for &>.

final def zipRight[R1 <: R, E1 >: E, B](that: => ZIO[R1, E1, B]): ZIO[R1, E1, B]

A named alias for *>.

A named alias for *>.

final def zipWith[R1 <: R, E1 >: E, B, C](that: => ZIO[R1, E1, B])(f: (A, B) => C): ZIO[R1, E1, C]

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.

final def zipWithPar[R1 <: R, E1 >: E, B, C](that: ZIO[R1, E1, B])(f: (A, B) => C): ZIO[R1, E1, C]

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.

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.

final def ||[R1 <: R, E1 >: E](that: => ZIO[R1, E1, Boolean])(implicit ev: A <:< Boolean): ZIO[R1, E1, Boolean]

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.

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.

final def |||[R1, E1 >: E, A1 >: A](that: ZIO[R1, E1, A1]): ZIO[Either[R, R1], E1, A1]

Depending on provided environment returns either this one or the other effect.

Depending on provided environment returns either this one or the other effect.

Deprecated methods

@deprecated("use mapBoth", "2.0.0")
final def bimap[E2, B](f: E => E2, g: A => B)(implicit ev: CanFail[E]): ZIO[R, E2, B]

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.

Deprecated

Inherited methods

def toCompletableFuture[A1 >: A](implicit ev: E <:< Throwable): URIO[R, CompletableFuture[A1]]
Inherited from:
ZIOPlatformSpecific
Inherited from:
ZIOPlatformSpecific