final class Ensuring[R, E, A] extends ZIO[R, E, A]
- Alphabetic
- By Inheritance
- Ensuring
- ZIO
- Serializable
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
*>[R1 <: R, E1 >: E, B](that: ⇒ ZIO[R1, E1, B]): ZIO[R1, E1, B]
A variant of
flatMapthat ignores the value produced by this effect.A variant of
flatMapthat ignores the value produced by this effect.- Definition Classes
- ZIO
-
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.
- Definition Classes
- ZIO
-
final
def
<>[R1 <: R, E2, A1 >: A](that: ⇒ ZIO[R1, E2, A1]): ZIO[R1, E2, A1]
Operator alias for
orElse.Operator alias for
orElse.- Definition Classes
- ZIO
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
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
- Definition Classes
- ZIO
-
final
def
absolve[R1 <: R, E1, B](implicit ev1: <:<[ZIO[R, E, A], ZIO[R1, E1, Either[E1, B]]]): ZIO[R1, E1, B]
Returns an effect that submerges the error case of an
Eitherinto theZIO.Returns an effect that submerges the error case of an
Eitherinto theZIO. The inverse operation ofZIO.either.- Definition Classes
- ZIO
-
final
def
absorb(implicit ev: <:<[E, Throwable]): ZIO[R, Throwable, 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.
- Definition Classes
- ZIO
-
final
def
absorbWith(f: (E) ⇒ Throwable): ZIO[R, Throwable, 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.
- Definition Classes
- ZIO
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
final
def
bimap[E2, B](f: (E) ⇒ E2, g: (A) ⇒ B): ZIO[R, E2, B]
Returns an effect whose failure and success channels have been mapped by the specified pair of functions,
fandg.Returns an effect whose failure and success channels have been mapped by the specified pair of functions,
fandg.- Definition Classes
- ZIO
-
final
def
bracketOnError[R1 <: R, E1 >: E, B](release: (A) ⇒ ZIO[R1, Nothing, _])(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.
- Definition Classes
- ZIO
-
final
def
bracket_[R1 <: R, E1 >: E]: BracketAcquire_[R1, E1]
A less powerful variant of
bracketwhere the resource acquired by this effect is not needed.A less powerful variant of
bracketwhere the resource acquired by this effect is not needed.- Definition Classes
- ZIO
-
final
def
catchAll[R1 <: R, E2, A1 >: A](h: (E) ⇒ ZIO[R1, E2, A1]): ZIO[R1, E2, A1]
Recovers from all errors.
Recovers from all errors.
openFile("config.json").catchAll(_ => IO.succeed(defaultConfig))
- Definition Classes
- ZIO
-
final
def
catchSome[R1 <: R, E1 >: E, A1 >: A](pf: PartialFunction[E, ZIO[R1, E1, A1]]): 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") }
- Definition Classes
- ZIO
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
final
def
const[B](b: ⇒ B): ZIO[R, E, B]
Maps this effect to the specified constant while preserving the effects of this effect.
Maps this effect to the specified constant while preserving the effects of this effect.
- Definition Classes
- ZIO
-
final
def
delay(duration: Duration): ZIO[R with Clock, E, A]
Returns an effect that is delayed from this effect by the specified scalaz.zio.duration.Duration.
Returns an effect that is delayed from this effect by the specified scalaz.zio.duration.Duration.
- Definition Classes
- ZIO
-
final
def
either: ZIO[R, Nothing, 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 theEithersuccess 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 theEithersuccess case.This method is useful for recovering from
ZIOeffects that may fail.The error parameter of the returned
ZIOisNothing, since it is guaranteed theZIOeffect does not model failure.- Definition Classes
- ZIO
-
final
def
ensuring(finalizer: UIO[_]): ZIO[R, E, A]
Returns an effect that, if this effect _starts_ execution, then the specified
finalizeris guaranteed to begin execution, whether this effect succeeds, fails, or is interrupted.Returns an effect that, if this effect _starts_ execution, then the specified
finalizeris guaranteed to begin execution, whether this effect succeeds, fails, or is interrupted.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.- Definition Classes
- ZIO
-
final
def
ensuringR[R1 <: R](finalizer: ZIO[R1, Nothing, _]): ZIO[R1, E, A]
Executes the specified finalizer, providing the environment of this
ZIOdirectly and immediately to the finalizer.Executes the specified finalizer, providing the environment of this
ZIOdirectly and immediately to the finalizer. This method should not be used for cleaning up resources, because it's possible the fiber will be interrupted after acquisition but before the finalizer is added.- Definition Classes
- ZIO
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
- val finalizer: UIO[_]
-
final
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))
- Definition Classes
- ZIO
-
final
def
flatMapError[R1 <: R, E2](f: (E) ⇒ ZIO[R1, Nothing, E2]): 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))
- Definition Classes
- ZIO
-
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.
- Definition Classes
- ZIO
-
final
def
flip: ZIO[R, A, E]
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.
- Definition Classes
- ZIO
-
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
fand flips the parameters backSwaps the error/value parameters, applies the function
fand flips the parameters back- Definition Classes
- ZIO
-
final
def
fold[B](err: (E) ⇒ B, succ: (A) ⇒ B): ZIO[R, Nothing, 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.- Definition Classes
- ZIO
-
final
def
foldCauseM[R1 <: R, E2, B](err: (Cause[E]) ⇒ ZIO[R1, E2, B], succ: (A) ⇒ ZIO[R1, E2, B]): ZIO[R1, E2, B]
A more powerful version of
foldMthat allows recovering from any kind of failure except interruptions.A more powerful version of
foldMthat allows recovering from any kind of failure except interruptions.- Definition Classes
- ZIO
-
final
def
foldM[R1 <: R, E2, B](err: (E) ⇒ ZIO[R1, E2, B], succ: (A) ⇒ ZIO[R1, E2, B]): 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
eithersince no intermediate value is allocated and does not require subsequent calls toflatMapto define the next effect.The error parameter of the returned
IOmay be chosen arbitrarily, since it will depend on theIOs returned by the given continuations.- Definition Classes
- ZIO
-
final
def
forever: ZIO[R, E, Nothing]
Repeats this effect forever (until the first error).
Repeats this effect forever (until the first error). For more sophisticated schedules, see the
repeatmethod.- Definition Classes
- ZIO
-
final
def
fork: ZIO[R, Nothing, Fiber[E, A]]
Returns an effect that forks this effect into its own separate fiber, returning the fiber immediately, without waiting for it to compute its value.
Returns an effect that forks this effect into its own separate fiber, returning the fiber immediately, without waiting for it to compute its value.
The returned fiber can be used to interrupt the forked fiber, await its result, or join the fiber. See scalaz.zio.Fiber for more information.
for { fiber <- subtask.fork // Do stuff... a <- fiber.join } yield a
- Definition Classes
- ZIO
-
final
def
forkOn(ec: ExecutionContext): ZIO[R, E, Fiber[E, A]]
Forks an effect that will be executed on the specified
ExecutionContext.Forks an effect that will be executed on the specified
ExecutionContext.- Definition Classes
- ZIO
-
final
def
get[E1 >: E, B](implicit ev1: =:=[E1, Nothing], ev2: <:<[A, Option[B]]): ZIO[R, Unit, B]
Unwraps the optional success of this effect, but can fail with unit value.
Unwraps the optional success of this effect, but can fail with unit value.
- Definition Classes
- ZIO
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
lock(executor: Executor): ZIO[R, E, A]
Returns an effect whose execution is locked to the specified executor.
Returns an effect whose execution is locked to the specified executor. This is useful when an effect must be executued 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.
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.
- Definition Classes
- ZIO
-
final
def
managed(release: (A) ⇒ UIO[_]): ZManaged[R, E, A]
- Definition Classes
- ZIO
-
final
def
map[B](f: (A) ⇒ B): ZIO[R, E, B]
Returns an effect whose success is mapped by the specified
ffunction.Returns an effect whose success is mapped by the specified
ffunction.- Definition Classes
- ZIO
-
final
def
mapError[E2](f: (E) ⇒ E2): ZIO[R, E2, A]
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.
- Definition Classes
- ZIO
-
final
def
memoize: ZIO[R, Nothing, IO[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.
- Definition Classes
- ZIO
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
on(ec: ExecutionContext): ZIO[R, E, A]
Executes the effect on the specified
ExecutionContextand then shifts back to the default one.Executes the effect on the specified
ExecutionContextand then shifts back to the default one.- Definition Classes
- ZIO
-
final
def
onError(cleanup: (Cause[E]) ⇒ UIO[_]): ZIO[R, E, A]
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.
- Definition Classes
- ZIO
-
final
def
onInterrupt(cleanup: UIO[_]): ZIO[R, E, A]
Runs the specified effect if this effect is interrupted.
Runs the specified effect if this effect is interrupted.
- Definition Classes
- ZIO
-
final
def
onTermination(cleanup: (Cause[Nothing]) ⇒ UIO[_]): ZIO[R, 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.
- Definition Classes
- ZIO
-
final
def
option: ZIO[R, Nothing, Option[A]]
Executes this effect, skipping the error but returning optionally the success.
Executes this effect, skipping the error but returning optionally the success.
- Definition Classes
- ZIO
-
final
def
orDie[E1 >: E](implicit ev: <:<[E1, Throwable]): ZIO[R, Nothing, 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.
- Definition Classes
- ZIO
-
final
def
orDieWith(f: (E) ⇒ Throwable): ZIO[R, Nothing, A]
Keeps none of the errors, and terminates the fiber with them, using the specified function to convert the
Einto aThrowable.Keeps none of the errors, and terminates the fiber with them, using the specified function to convert the
Einto aThrowable.- Definition Classes
- ZIO
-
final
def
orElse[R1 <: R, E2, A1 >: A](that: ⇒ ZIO[R1, E2, A1]): 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.
- Definition Classes
- ZIO
-
final
def
orElseEither[R1 <: R, E2, B](that: ⇒ ZIO[R1, E2, B]): 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.
- Definition Classes
- ZIO
-
final
def
provide(r: R): IO[E, A]
Provides the
ZIOprogram with its required environment, which eliminates its dependency onR.Provides the
ZIOprogram with its required environment, which eliminates its dependency onR.- Definition Classes
- ZIO
-
final
def
provideSome[R0](f: (R0) ⇒ 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.val effect: ZIO[Console with Logging, Nothing, Unit] = ??? effect.provideSome[Console](console => new Console with Logging { val console = console val logging = new Logging def log(line: String) = console.putStrLn(line) } } )
- Definition Classes
- ZIO
-
final
def
provideSomeM[R0, R1 >: R0, E1 >: E](f: (R1) ⇒ ZIO[R0, E1, R]): ZIO[R0, E1, A]
An effectful version of
provideSome, useful when the act of partial provision requires an effect.An effectful version of
provideSome, useful when the act of partial provision requires an effect.- Definition Classes
- ZIO
-
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
Afrom the faster side.Returns an effect that races this effect with the specified effect, returning the first successful
Afrom the faster side. If one effect succeeds, the other will be interrupted. If neither succeeds, then the effect will fail with some error.- Definition Classes
- ZIO
-
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.
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
- Definition Classes
- ZIO
-
final
def
raceAttempt[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.
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.
- Definition Classes
- ZIO
-
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.
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.
- Definition Classes
- ZIO
-
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]): 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.
- Definition Classes
- ZIO
-
final
def
refineOrDie[E1](pf: PartialFunction[E, E1])(implicit ev: <:<[E, Throwable]): 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.
- Definition Classes
- ZIO
-
final
def
refineOrDieWith[E1](pf: PartialFunction[E, E1])(f: (E) ⇒ Throwable): ZIO[R, E1, A]
Keeps some of the errors, and terminates the fiber with the rest, using the specified function to convert the
Einto aThrowable.Keeps some of the errors, and terminates the fiber with the rest, using the specified function to convert the
Einto aThrowable.- Definition Classes
- ZIO
-
final
def
repeat[R1 <: R, B](schedule: ZSchedule[R1, A, B]): ZIO[R1 with Clock, E, B]
Repeats this effect with the specified schedule until the schedule completes, or until the first failure.
Repeats this effect with the specified schedule until the schedule completes, or until the first failure. Repeats are done in addition to the first execution so that
io.repeat(Schedule.once)means "execute io and in case of success repeatioonce".- Definition Classes
- ZIO
-
final
def
repeatOrElse[R1 <: R, E2, B](schedule: ZSchedule[R1, A, B], orElse: (E, Option[B]) ⇒ ZIO[R1, E2, B]): ZIO[R1 with Clock, E2, B]
Repeats this effect with the specified schedule until the schedule completes, or until the first failure.
Repeats this effect with the specified schedule until the schedule completes, or until the first failure. In the event of failure the progress to date, together with the error, will be passed to the specified handler.
- Definition Classes
- ZIO
-
final
def
repeatOrElseEither[R1 <: R, B, E2, C](schedule: ZSchedule[R1, A, B], orElse: (E, Option[B]) ⇒ ZIO[R1 with Clock, E2, C]): ZIO[R1 with Clock, E2, Either[C, B]]
Repeats this effect with the specified schedule until the schedule completes, or until the first failure.
Repeats this effect with the specified schedule until the schedule completes, or until the first failure. In the event of failure the progress to date, together with the error, will be passed to the specified handler.
- Definition Classes
- ZIO
-
final
def
retry[R1 <: R, E1 >: E, S](policy: ZSchedule[R1, E1, S]): ZIO[R1 with Clock, E1, A]
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 withonceorrecursfor example), so that thatio.retry(Schedule.once)means "executeioand in case of failure, try again once".- Definition Classes
- ZIO
-
final
def
retryOrElse[R1 <: R, A2 >: A, E1 >: E, S, E2](policy: ZSchedule[R1, E1, S], orElse: (E1, S) ⇒ ZIO[R1, E2, A2]): ZIO[R1 with Clock, E2, A2]
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.
- Definition Classes
- ZIO
-
final
def
retryOrElseEither[R1 <: R, E1 >: E, S, E2, B](policy: ZSchedule[R1, E1, S], orElse: (E1, S) ⇒ ZIO[R1, E2, B]): ZIO[R1 with Clock, E2, Either[B, A]]
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.
- Definition Classes
- ZIO
-
final
def
run: ZIO[R, Nothing, Exit[E, A]]
Returns an effect that semantically runs the effect on a fiber, producing an scalaz.zio.Exit for the completion value of the fiber.
Returns an effect that semantically runs the effect on a fiber, producing an scalaz.zio.Exit for the completion value of the fiber.
- Definition Classes
- ZIO
-
final
def
sandbox: ZIO[R, Cause[E], A]
Runs this effect in a new fiber, resuming when the fiber terminates.
Runs this effect in a new fiber, resuming when the fiber terminates.
If the fiber fails with an error it will be captured in Right side of the error Either If the fiber terminates because of defect, list of defects will be captured in the Left side of the Either
Allows 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: UIO[Unit] = veryBadIO.sandbox.catchAll { case Cause.Die(_: ArithmeticException) => // Caught defect: divided by zero! IO.succeed(0) case Cause.Fail(e) => // Caught error: DomainError! IO.succeed(0) case cause => // Caught unknown defects, shouldn't recover! IO.halt(cause) * }
- Definition Classes
- ZIO
-
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.Companion helper to
sandbox.Has a performance penalty due to forking a new fiber.
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
sandboxWithwithcatchSomeis better than usingio.sandbox.catchAllwith a partial match, because in the latter, if the match fails, the original defects will be lost and replaced by aMatchError- Definition Classes
- ZIO
-
final
def
summarized[R1 <: R, E1 >: E, B, C](f: (B, B) ⇒ C)(summary: ZIO[R1, E1, B]): 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.
- Definition Classes
- ZIO
-
final
def
supervise: ZIO[R, E, A]
Supervises this effect, which ensures that any fibers that are forked by the effect are interrupted when this effect completes.
Supervises this effect, which ensures that any fibers that are forked by the effect are interrupted when this effect completes.
- Definition Classes
- ZIO
-
final
def
superviseWith(supervisor: (Iterable[Fiber[_, _]]) ⇒ UIO[_]): ZIO[R, E, A]
Supervises this effect, which ensures that any fibers that are forked by the effect are handled by the provided supervisor.
Supervises this effect, which ensures that any fibers that are forked by the effect are handled by the provided supervisor.
- Definition Classes
- ZIO
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
tag: Int
An integer that identifies the term in the
ZIOsum type to which this instance belongs (e.g. -
final
def
tap[R1 <: R, E1 >: E](f: (A) ⇒ ZIO[R1, E1, _]): 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)- Definition Classes
- ZIO
-
final
def
tapBoth[R1 <: R, E1 >: E, A1 >: A](f: (E) ⇒ ZIO[R1, E1, _], g: (A) ⇒ ZIO[R1, E1, _]): ZIO[R1, E1, A]
Returns an effect that effectfully "peeks" at the failure or success or this effect.
Returns an effect that effectfully "peeks" at the failure or success or this effect.
readFile("data.json").tapBoth(logError(_), logData(_))- Definition Classes
- ZIO
-
final
def
timed: ZIO[R with 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.
- Definition Classes
- ZIO
-
final
def
timedWith[R1 <: R, E1 >: E](nanoTime: ZIO[R1, E1, Long]): ZIO[R1, E1, (Duration, A)]
A more powerful variation of
timedthat allows specifying the clock.A more powerful variation of
timedthat allows specifying the clock.- Definition Classes
- ZIO
-
final
def
timeout(d: Duration): ZIO[R with Clock, E, Option[A]]
Returns an effect that will timeout this effect, returning
Noneif the timeout elapses before the effect has produced a value; and returningSomeof the produced value otherwise.Returns an effect that will timeout this effect, returning
Noneif the timeout elapses before the effect has produced a value; and returningSomeof the produced value otherwise.If the timeout elapses without producing a value, the running effect will be safely interrupted
- Definition Classes
- ZIO
-
final
def
timeoutFail[E1 >: E](e: E1)(d: Duration): ZIO[R with Clock, E1, A]
The same as timeout, but instead of producing a
Nonein the event of timeout, it will produce the specified error. -
final
def
timeoutTo[R1 <: R, E1 >: E, A1 >: A, B](b: B): TimeoutTo[R1, E1, A1, 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
fto 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
fto 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)
- Definition Classes
- ZIO
-
final
def
to[E1 >: E, A1 >: A](p: Promise[E1, A1]): ZIO[R, Nothing, Boolean]
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.
- Definition Classes
- ZIO
-
final
def
toFuture[R1 <: R](implicit ev1: =:=[Any, R1], ev2: <:<[E, Throwable]): UIO[Future[A]]
Converts the effect to a scala.concurrent.Future.
Converts the effect to a scala.concurrent.Future.
- Definition Classes
- ZIO
-
final
def
toFutureWith(r: R, f: (E) ⇒ Throwable): UIO[Future[A]]
Converts the effect into a scala.concurrent.Future.
Converts the effect into a scala.concurrent.Future.
- Definition Classes
- ZIO
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
uninterruptible: ZIO[R, E, A]
Performs this effect non-interruptibly.
Performs this effect non-interruptibly. 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.
- Definition Classes
- ZIO
-
final
def
unsandbox[R1 <: R, E1, A1 >: A](implicit ev1: <:<[ZIO[R, E, A], ZIO[R1, Cause[E1], A1]]): ZIO[R1, E1, A1]
The inverse operation to
sandboxThe inverse operation to
sandboxTerminates with exceptions on the
Leftside of theEithererror, if it exists. Otherwise extracts the containedIO[E, A]- Definition Classes
- ZIO
-
final
def
void: 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.
- Definition Classes
- ZIO
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
final
def
when[R1 <: R, E1 >: E](b: Boolean): ZIO[R1, E1, Unit]
The moral equivalent of
if (p) expThe moral equivalent of
if (p) exp- Definition Classes
- ZIO
-
final
def
whenM[R1 <: R, E1 >: E](b: ZIO[R1, Nothing, Boolean]): ZIO[R1, E1, Unit]
The moral equivalent of
if (p) expwhenphas side-effectsThe moral equivalent of
if (p) expwhenphas side-effects- Definition Classes
- ZIO
- val zio: ZIO[R, E, A]
-
final
def
zip[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.
- Definition Classes
- ZIO
-
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
<*.- Definition Classes
- ZIO
-
final
def
zipPar[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.
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, interrupted the result.
- Definition Classes
- ZIO
-
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
*>.- Definition Classes
- ZIO
-
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.
- Definition Classes
- ZIO
-
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
ffunction.Returns an effect that executes both this effect and the specified effect, in parallel, combining their results with the specified
ffunction. If either side fails, then the other side will be interrupted.- Definition Classes
- ZIO