AsyncZio

izumi.functional.bio.impl.AsyncZio
See theAsyncZio companion object
open class AsyncZio[R] extends Async2[[_, _] =>> ZIO[R, _$1, _$2]]

Attributes

Companion
object
Graph
Supertypes
trait Async2[[_, _] =>> ZIO[R, _$1, _$2]]
trait WeakAsync2[[_, _] =>> ZIO[R, _$1, _$2]]
trait IO2[[_, _] =>> ZIO[R, _$1, _$2]]
trait Panic2[[_, _] =>> ZIO[R, _$1, _$2]]
trait Bracket2[[_, _] =>> ZIO[R, _$1, _$2]]
trait Error2[[_, _] =>> ZIO[R, _$1, _$2]]
trait ErrorAccumulatingOps2[[_, _] =>> ZIO[R, _$1, _$2]]
trait Monad2[[_, _] =>> ZIO[R, _$1, _$2]]
trait ApplicativeError2[[_, _] =>> ZIO[R, _$1, _$2]]
trait Bifunctor2[[_, _] =>> ZIO[R, _$1, _$2]]
trait Guarantee2[[_, _] =>> ZIO[R, _$1, _$2]]
trait Applicative2[[_, _] =>> ZIO[R, _$1, _$2]]
trait Functor2[[_, _] =>> ZIO[R, _$1, _$2]]
trait Concurrent2[[_, _] =>> ZIO[R, _$1, _$2]]
trait ParallelErrorAccumulatingOps2[[_, _] =>> ZIO[R, _$1, _$2]]
trait Parallel2[[_, _] =>> ZIO[R, _$1, _$2]]
trait RootBifunctor[[_, _] =>> ZIO[R, _$1, _$2]]
trait Root
class Object
trait Matchable
class Any
Show all
Known subtypes
object AsyncZio
class TemporalZio[R]
object TemporalZio

Members list

Type members

Inherited types

Attributes

Inherited from:
DivergenceHelper

Attributes

Inherited from:
PredefinedHelper

Value members

Concrete methods

final override def *>[E, A, B](f: ZIO[R, E, A], next: => ZIO[R, E, B]): ZIO[R, E, B]

execute two operations in order, return result of second operation

execute two operations in order, return result of second operation

Attributes

Definition Classes
final override def <*[E, A, B](f: ZIO[R, E, A], next: => ZIO[R, E, B]): ZIO[R, E, A]

execute two operations in order, same as *>, but return result of first operation

execute two operations in order, same as *>, but return result of first operation

Attributes

Definition Classes
override def InnerF: this.type
final override def as[E, A, B](r: ZIO[R, E, A])(v: => B): ZIO[R, E, B]

Attributes

Definition Classes
final override def async[E, A](register: (Either[E, A] => Unit) => Unit): ZIO[Any, E, A]

Construct an effect from an asynchronous callback-based API.

Construct an effect from an asynchronous callback-based API.

The callback provided to register must be invoked exactly once with either a success value wrapped in Right or an error wrapped in Left.

Example:

 def readFile[F[+_, +_]: WeakAsync2](path: String): F[Throwable, String] = {
   F.async { cb =>
     asyncFileReader.read(path)(
       onSuccess = content => cb(Right(content)),
       onError = err => cb(Left(err))
     )
   }
 }

Attributes

Note

Effects created with async, asyncF, asyncWithOnInterrupt, fromFuture and fromFutureJava are INTERRUPTIBLE. - In case of async and asyncF if the current fiber is interrupted, the registered callback will be simply THROWN AWAY. - If a cleanup action is required to wind down the async operation safely, use asyncWithOnInterrupt to provide a cleanup action. - If an async operation's callback CANNOT be safely discarded OR interrupted, wrap your expression in Panic2.uninterruptible.

to implementors: The effect produced MUST be interruptible.

Definition Classes
final override def asyncF[E, A](register: (Either[E, A] => Unit) => ZIO[R, E, Unit]): ZIO[R, E, A]

Same as async, but registration action can use F capabilities. Registration action itself is uninterruptible, but the produced effect is interruptible.

Same as async, but registration action can use F capabilities. Registration action itself is uninterruptible, but the produced effect is interruptible.

Attributes

Note

Effects created with async, asyncF, asyncWithOnInterrupt, fromFuture and fromFutureJava are INTERRUPTIBLE. - In case of async and asyncF if the current fiber is interrupted, the registered callback will be simply THROWN AWAY. - If a cleanup action is required to wind down the async operation safely, use asyncWithOnInterrupt to provide a cleanup action. - If an async operation's callback CANNOT be safely discarded OR interrupted, wrap your expression in Panic2.uninterruptible.

to implementors: The effect produced MUST be interruptible.

Definition Classes
final override def asyncWithOnInterrupt[E, A](register: (Either[E, A] => Unit) => InterruptAction[[_, _] =>> ZIO[R, _$13, _$14]]): ZIO[R, E, A]

Just as in async, registers async callback impurely, but also returns an F effect that will be executed to interrupt the async action if the current fiber is interrupted

Just as in async, registers async callback impurely, but also returns an F effect that will be executed to interrupt the async action if the current fiber is interrupted

Attributes

Note

Effects created with async, asyncF, asyncWithOnInterrupt, fromFuture and fromFutureJava are INTERRUPTIBLE. - In case of async and asyncF if the current fiber is interrupted, the registered callback will be simply THROWN AWAY. - If a cleanup action is required to wind down the async operation safely, use asyncWithOnInterrupt to provide a cleanup action. - If an async operation's callback CANNOT be safely discarded OR interrupted, wrap your expression in Panic2.uninterruptible.

to implementors: The effect produced MUST be interruptible.

Definition Classes
final override def attempt[E, A](r: ZIO[R, E, A]): ZIO[R, Nothing, Either[E, A]]

Attributes

Definition Classes
final override def bimap[E, A, E2, B](r: ZIO[R, E, A])(f: E => E2, g: A => B): ZIO[R, E2, B]

Attributes

Definition Classes
final override def bracket[E, A, B](acquire: ZIO[R, E, A])(release: A => ZIO[R, Nothing, Unit])(use: A => ZIO[R, E, B]): ZIO[R, E, B]

Attributes

Definition Classes
final override def bracketCase[E, A, B](acquire: ZIO[R, E, A])(release: (A, Exit[E, B]) => ZIO[R, Nothing, Unit])(use: A => ZIO[R, E, B]): ZIO[R, E, B]

Attributes

Definition Classes
final override def bracketExcept[E, A, B](acquire: RestoreInterruption2[[_, _] =>> ZIO[R, _$31, _$32]] => ZIO[R, E, A])(release: (A, Exit[E, B]) => ZIO[R, Nothing, Unit])(use: A => ZIO[R, E, B]): ZIO[R, E, B]

Like bracketCase, but acquire can contain marked interruptible regions as in uninterruptibleExcept

Like bracketCase, but acquire can contain marked interruptible regions as in uninterruptibleExcept

Attributes

Definition Classes
final override def catchAll[E, A, E2](r: ZIO[R, E, A])(f: E => ZIO[R, E2, A]): ZIO[R, E2, A]

Attributes

Definition Classes
final override def catchSome[E, A, E1 >: E](r: ZIO[R, E, A])(f: PartialFunction[E, ZIO[R, E1, A]]): ZIO[R, E1, A]

Attributes

Definition Classes
final override def collectFirst[E, A, B](l: Iterable[A])(f: A => ZIO[R, E, Option[B]]): ZIO[R, E, Option[B]]

Attributes

Definition Classes
final override def currentEC: ZIO[Any, Nothing, ExecutionContext]

Attributes

Definition Classes
final override def fail[E](v: => E): ZIO[Any, E, Nothing]

Attributes

Definition Classes
final override def filter[E, A](l: Iterable[A])(f: A => ZIO[R, E, Boolean]): ZIO[R, E, List[A]]

Attributes

Definition Classes
final override def find[E, A](l: Iterable[A])(f: A => ZIO[R, E, Boolean]): ZIO[R, E, Option[A]]

Attributes

Definition Classes
final override def flatMap[E, A, B](r: ZIO[R, E, A])(f0: A => ZIO[R, E, B]): ZIO[R, E, B]

Attributes

Definition Classes
final override def flatten[E, A](r: ZIO[R, E, ZIO[R, E, A]]): ZIO[R, E, A]

Attributes

Definition Classes
final override def flip[E, A](r: ZIO[R, E, A]): ZIO[R, A, E]

Attributes

Definition Classes
final override def foldLeft[E, A, AC](l: Iterable[A])(z: AC)(f: (AC, A) => ZIO[R, E, AC]): ZIO[R, E, AC]

Attributes

Definition Classes
final override def fromAttempt[A](effect: => A): ZIO[R, Throwable, A]

For lazy monads: alias for IO2#syncThrowable. For strict monads, shorthand for F.fromTry(Try(effect))

For lazy monads: alias for IO2#syncThrowable. For strict monads, shorthand for F.fromTry(Try(effect))

Attributes

Definition Classes
final override def fromEither[E, A](effect: => Either[E, A]): ZIO[Any, E, A]

Attributes

Definition Classes
final override def fromFuture[A](mkFuture: ExecutionContext => Future[A]): ZIO[Any, Throwable, A]

Attributes

Note

to implementors: The effect produced MUST be interruptible (cats.effect.IO's fromFuture is not!)

Definition Classes
final override def fromFutureJava[A](javaFuture: => CompletionStage[A]): ZIO[Any, Throwable, A]

Attributes

Note

to implementors: The effect produced MUST be interruptible and call java.util.concurrent.Future.cancel on interrupt

Definition Classes
final override def fromOption[E, A](errorOnNone: => E)(effect: => Option[A]): ZIO[Any, E, A]

Attributes

Definition Classes
final override def fromOptionF[E, A](fallbackOnNone: => ZIO[R, E, A], r: ZIO[R, E, Option[A]]): ZIO[R, E, A]

Extracts the optional value, or executes the fallbackOnNone effect

Extracts the optional value, or executes the fallbackOnNone effect

Attributes

Definition Classes
final override def fromOptionOr[E, A](valueOnNone: => A, r: ZIO[R, E, Option[A]]): ZIO[R, E, A]

Extracts the optional value, or returns the given valueOnNone value

Extracts the optional value, or returns the given valueOnNone value

Attributes

Definition Classes
final override def fromTry[A](effect: => Try[A]): ZIO[Any, Throwable, A]

Attributes

Definition Classes
final override def guarantee[E, A](f: ZIO[R, E, A], cleanup: ZIO[R, Nothing, Unit]): ZIO[R, E, A]

Attributes

Definition Classes
final override def guaranteeCase[E, A](f: ZIO[R, E, A], cleanup: Exit[E, A] => ZIO[R, Nothing, Unit]): ZIO[R, E, A]

Attributes

Definition Classes
final override def iterateUntil[E, A](r: ZIO[R, E, A])(p: A => Boolean): ZIO[R, E, A]

Execute an action repeatedly until its result satisfies the given predicate and return that result, discarding all others.

Execute an action repeatedly until its result satisfies the given predicate and return that result, discarding all others.

Attributes

Definition Classes
final override def iterateWhile[E, A](r: ZIO[R, E, A])(p: A => Boolean): ZIO[R, E, A]

Execute an action repeatedly until its result fails to satisfy the given predicate and return that result, discarding all others.

Execute an action repeatedly until its result fails to satisfy the given predicate and return that result, discarding all others.

Attributes

Definition Classes
final override def leftFlatMap[E, A, E2](r: ZIO[R, E, A])(f: E => ZIO[R, Nothing, E2]): ZIO[R, E2, A]

Attributes

Definition Classes
final override def leftMap[E, A, E2](r: ZIO[R, E, A])(f: E => E2): ZIO[R, E2, A]

Attributes

Definition Classes
final override def leftMap2[E, A, E2, E3](firstOp: ZIO[R, E, A], secondOp: => ZIO[R, E2, A])(f: (E, E2) => E3): ZIO[R, E3, A]

map errors from two operations into a new error if both fail

map errors from two operations into a new error if both fail

Attributes

Definition Classes
final override def map[E, A, B](r: ZIO[R, E, A])(f: A => B): ZIO[R, E, B]

Attributes

Definition Classes
final override def map2[E, A, B, C](r1: ZIO[R, E, A], r2: => ZIO[R, E, B])(f: (A, B) => C): ZIO[R, E, C]

execute two operations in order, map their results

execute two operations in order, map their results

Attributes

Definition Classes
final override def never: ZIO[Any, Nothing, Nothing]

Attributes

Definition Classes
final override def onEC[E, A](ec: ExecutionContext)(f: ZIO[R, E, A]): ZIO[R, E, A]

Attributes

Definition Classes
final override def orElse[E, A, E2](r: ZIO[R, E, A], f: => ZIO[R, E2, A]): ZIO[R, E2, A]

execute second operation only if the first one fails

execute second operation only if the first one fails

Attributes

Definition Classes
final override def parTraverse[E, A, B](l: Iterable[A])(f: A => ZIO[R, E, B]): ZIO[R, E, List[B]]

Attributes

Definition Classes
final override def parTraverseN[E, A, B](maxConcurrent: Int)(l: Iterable[A])(f: A => ZIO[R, E, B]): ZIO[R, E, List[B]]

Attributes

Definition Classes
final override def parTraverseNCore[E, A, B](l: Iterable[A])(f: A => ZIO[R, E, B]): ZIO[R, E, List[B]]

parTraverseN with maxConcurrent set to the number of cores, or 2 when on single-core processor

parTraverseN with maxConcurrent set to the number of cores, or 2 when on single-core processor

Attributes

Definition Classes
final override def parTraverseNCore_[E, A](l: Iterable[A])(f: A => ZIO[R, E, Unit]): ZIO[R, E, Unit]

Attributes

Definition Classes
final override def parTraverseN_[E, A](maxConcurrent: Int)(l: Iterable[A])(f: A => ZIO[R, E, Unit]): ZIO[R, E, Unit]

Attributes

Definition Classes
final override def parTraverse_[E, A](l: Iterable[A])(f: A => ZIO[R, E, Unit]): ZIO[R, E, Unit]

Attributes

Definition Classes
final override def pure[A](a: A): ZIO[Any, Nothing, A]

Attributes

Definition Classes
final override def race[E, A](r1: ZIO[R, E, A], r2: ZIO[R, E, A]): ZIO[R, E, A]

Race two actions, the winner is the first action to TERMINATE, whether by success or failure

Race two actions, the winner is the first action to TERMINATE, whether by success or failure

Attributes

Definition Classes
final override def racePairUnsafe[E, A, B](r1: ZIO[R, E, A], r2: ZIO[R, E, B]): ZIO[R, E, Either[(Exit[E, A], Fiber2[[_, _] =>> ZIO[R, _$18, _$19], E, B]), (Fiber2[[_, _] =>> ZIO[R, _$20, _$21], E, A], Exit[E, B])]]

Race two actions, the winner is the first action to TERMINATE, whether by success or failure

Race two actions, the winner is the first action to TERMINATE, whether by success or failure

Unlike race, the loser is not interrupted after the winner has terminated - whether by success or failure.

Attributes

Definition Classes
final override def redeem[E, A, E2, B](r: ZIO[R, E, A])(err: E => ZIO[R, E2, B], succ: A => ZIO[R, E2, B]): ZIO[R, E2, B]

Attributes

Definition Classes
final override def redeemPure[E, A, B](r: ZIO[R, E, A])(err: E => B, succ: A => B): ZIO[R, Nothing, B]

Attributes

Definition Classes
final override def retryUntil[E, A](r: ZIO[R, E, A])(f: E => Boolean): ZIO[R, E, A]

Retries this effect until its error satisfies the specified predicate.

Retries this effect until its error satisfies the specified predicate.

Attributes

Definition Classes
final override def retryUntilF[E, A](r: ZIO[R, E, A])(f: E => ZIO[R, Nothing, Boolean]): ZIO[R, E, A]

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

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

Attributes

Definition Classes
final override def retryWhile[E, A](r: ZIO[R, E, A])(f: E => Boolean): ZIO[R, E, A]

Retries this effect while its error satisfies the specified predicate.

Retries this effect while its error satisfies the specified predicate.

Attributes

Definition Classes
final override def retryWhileF[E, A](r: ZIO[R, E, A])(f: E => ZIO[R, Nothing, Boolean]): ZIO[R, E, A]

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

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

Attributes

Definition Classes
final override def sandbox[E, A](r: ZIO[R, E, A]): ZIO[R, FailureUninterrupted[E], A]

Attributes

Note

Will return either Exit.Success, Exit.Error or Exit.Termination. Exit.Interruption cannot be sandboxed – use guaranteeOnInterrupt for cleanups on interruptions.

Definition Classes
final override def sendInterruptToSelf: ZIO[Any, Nothing, Unit]

Signal interruption to this fiber.

Signal interruption to this fiber.

This is NOT the same as

 F.halt(Exit.Interrupted(Trace.forUnknownError))

The code above exits with Exit.Interrupted failure unconditionally, whereas sendInterruptToSelf will not exit when in an uninterruptible region. Example:

 F.uninterruptible {
   F.halt(Exit.Interrupted(Trace.forUnknownError)) *>
   F.sync(println("Hello!")) // interrupted above. Hello _not_ printed
 }

But with sendInterruptToSelf:

 F.uninterruptible {
   F.sendInterruptToSelf *>
   F.sync(println("Hello!")) // Hello IS printed.
 } *> F.sync(println("Impossible")) // interrupted immediately after `uninterruptible` block ends. Impossible _not_ printed

Attributes

See also
Definition Classes
final override def sequence[E, A](l: Iterable[ZIO[R, E, A]]): ZIO[R, E, List[A]]

Attributes

Definition Classes
final override def sequence_[E](l: Iterable[ZIO[R, E, Unit]]): ZIO[R, E, Unit]

Attributes

Definition Classes
final override def suspendSafe[E, A](effect: => ZIO[R, E, A]): ZIO[R, E, A]

Capture an exception-safe side-effect that returns another effect

Capture an exception-safe side-effect that returns another effect

Attributes

Definition Classes
IO2
final override def suspendThrowable[A](effect: => ZIO[R, Throwable, A]): ZIO[R, Throwable, A]

Capture a side-effectful block of code that can throw exceptions and returns another effect

Capture a side-effectful block of code that can throw exceptions and returns another effect

Attributes

Definition Classes
IO2
final override def sync[A](effect: => A): ZIO[Any, Nothing, A]

Capture an exception-safe side-effect such as memory mutation or randomness

Capture an exception-safe side-effect such as memory mutation or randomness

Attributes

Note

If you're not completely sure that a captured block can't throw, use syncThrowable

sync means synchronous, that is, a blocking CPU effect, as opposed to a non-blocking asynchronous effect or a long blocking I/O effect (izumi.functional.bio.BlockingIO2#syncBlocking)

Example
import izumi.functional.bio.F
val exceptionSafeArrayAllocation: F[Nothing, Array[Byte]] = {
 F.sync(new Array(256))
}
Definition Classes
IO2
final override def syncThrowable[A](effect: => A): ZIO[Any, Throwable, A]

Capture a side-effectful block of code that can throw exceptions

Capture a side-effectful block of code that can throw exceptions

Attributes

Note

sync means synchronous, that is, a blocking CPU effect, as opposed to a non-blocking asynchronous effect or a long blocking I/O effect (izumi.functional.bio.BlockingIO2#syncBlocking)

Definition Classes
IO2
final override def tap[E, A](r: ZIO[R, E, A], f: A => ZIO[R, E, Unit]): ZIO[R, E, A]

Attributes

Definition Classes
final override def tapBoth[E, A, E1 >: E](r: ZIO[R, E, A])(err: E => ZIO[R, E1, Unit], succ: A => ZIO[R, E1, Unit]): ZIO[R, E1, A]

Attributes

Definition Classes
final override def tapError[E, A, E1 >: E](r: ZIO[R, E, A])(f: E => ZIO[R, E1, Unit]): ZIO[R, E1, A]

Attributes

Definition Classes
final override def terminate(v: => Throwable): ZIO[Any, Nothing, Nothing]

Attributes

Definition Classes
final override def traverse[E, A, B](l: Iterable[A])(f: A => ZIO[R, E, B]): ZIO[R, E, List[B]]

Attributes

Definition Classes
final override def traverse_[E, A](l: Iterable[A])(f: A => ZIO[R, E, Unit]): ZIO[R, E, Unit]

Attributes

Definition Classes
final override def uninterruptible[E, A](f: ZIO[R, E, A]): ZIO[R, E, A]

Attributes

Definition Classes
final override def uninterruptibleExcept[E, A](f: RestoreInterruption2[[_, _] =>> ZIO[R, _$28, _$29]] => ZIO[R, E, A]): ZIO[R, E, A]

Designate the effect uninterruptible, with the exception of regions in it that are specifically marked to restore previous interruptibility status using the provided RestoreInterruption function

Designate the effect uninterruptible, with the exception of regions in it that are specifically marked to restore previous interruptibility status using the provided RestoreInterruption function

Attributes

Note

Interruptibility status will be restored to what it was in the outer region, so if the outer region was also uninterruptible, the provided RestoreInterruption will have no effect. e.g. the expression F.uninterruptible { F.uninterruptibleExcept { restore => restore(F.sleep(1.second)) } is fully uninterruptible throughout

Example
 F.uninterruptibleExcept {
   restoreInterruption =>
     val workLoop = {
       importantWorkThatMustNotBeInterrupted() *>
       log.info("Taking a break for a second, you can interrupt me while I wait!") *>
       restoreInterruption.apply {
         F.sleep(1.second)
          .guaranteeOnInterrupt(_ => log.info("Got interrupted!"))
       } *>
       log.info("No interruptions, going back to work!") *>
       workLoop
     }
     workLoop
 }
Definition Classes
final override def unit: ZIO[Any, Nothing, Unit]

Attributes

Definition Classes
final override def void[E, A](r: ZIO[R, E, A]): ZIO[R, E, Unit]

Attributes

Definition Classes
final override def yieldNow: ZIO[Any, Nothing, Unit]

Attributes

Definition Classes
final override def zipPar[E, A, B](fa: ZIO[R, E, A], fb: ZIO[R, E, B]): ZIO[R, E, (A, B)]

Returns an effect that executes both effects, 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 effects, in parallel, combining their results into a tuple. If either side fails, then the other side will be interrupted.

Attributes

Definition Classes
final override def zipParLeft[E, A, B](fa: ZIO[R, E, A], fb: ZIO[R, E, B]): ZIO[R, E, A]

Returns an effect that executes both effects, in parallel, the left effect result is returned. If either side fails, then the other side will be interrupted.

Returns an effect that executes both effects, in parallel, the left effect result is returned. If either side fails, then the other side will be interrupted.

Attributes

Definition Classes
final override def zipParRight[E, A, B](fa: ZIO[R, E, A], fb: ZIO[R, E, B]): ZIO[R, E, B]

Returns an effect that executes both effects, in parallel, the right effect result is returned. If either side fails, then the other side will be interrupted.

Returns an effect that executes both effects, in parallel, the right effect result is returned. If either side fails, then the other side will be interrupted.

Attributes

Definition Classes
final override def zipWithPar[E, A, B, C](fa: ZIO[R, E, A], fb: ZIO[R, E, B])(f: (A, B) => C): ZIO[R, E, C]

Returns an effect that executes both effects, 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 effects, in parallel, combining their results with the specified f function. If either side fails, then the other side will be interrupted.

Attributes

Definition Classes

Inherited methods

override protected def accumulateErrorsImpl[ColL[_], ColR <: (IterableOnce), E, E1, A, B, B1, AC](col: ColR[A])(effect: A => [_, _] =>> ZIO[R, _$1, _$2][E, B], onLeft: E => IterableOnce[E1], init: AC, onRight: (AC, B) => AC, end: AC => B1)(implicit buildL: Factory[E1, ColL[E1]]): [_, _] =>> ZIO[R, _$1, _$2][ColL[E1], B1]

Attributes

Definition Classes
Inherited from:
IO2
final def apply[A](effect: => A): [_, _] =>> ZIO[R, _$1, _$2][Throwable, A]

Attributes

Inherited from:
IO2
final def bracketOnFailure[E, A, B](acquire: [_, _] =>> ZIO[R, _$1, _$2][E, A])(cleanupOnFailure: (A, Failure[E]) => [_, _] =>> ZIO[R, _$1, _$2][Nothing, Unit])(use: A => [_, _] =>> ZIO[R, _$1, _$2][E, B]): [_, _] =>> ZIO[R, _$1, _$2][E, B]

Run release action only on a failure – any failure, INCLUDING interruption. Do not run release action if use finished successfully.

Run release action only on a failure – any failure, INCLUDING interruption. Do not run release action if use finished successfully.

Attributes

Inherited from:
Bracket2
def collect[E, A, B](l: Iterable[A])(f: A => [_, _] =>> ZIO[R, _$1, _$2][E, Option[B]]): [_, _] =>> ZIO[R, _$1, _$2][E, List[B]]

Attributes

Inherited from:
Applicative2
def flatSequence[E, A](l: Iterable[[_, _] =>> ZIO[R, _$1, _$2][E, Iterable[A]]]): [_, _] =>> ZIO[R, _$1, _$2][E, List[A]]

Attributes

Inherited from:
Applicative2
def flatSequenceAccumErrors[ColR <: (IterableOnce), ColIn <: (IterableOnce), ColL[_], E, A](col: ColR[[_, _] =>> ZIO[R, _$1, _$2][ColL[E], ColIn[A]]])(implicit buildR: Factory[A, ColR[A]], buildL: Factory[E, ColL[E]], iterL: ColL[E] => IterableOnce[E]): [_, _] =>> ZIO[R, _$1, _$2][ColL[E], ColR[A]]

flatSequence with error accumulation

flatSequence with error accumulation

Attributes

Inherited from:
ErrorAccumulatingOps2
def flatTraverse[E, A, B](l: Iterable[A])(f: A => [_, _] =>> ZIO[R, _$1, _$2][E, Iterable[B]]): [_, _] =>> ZIO[R, _$1, _$2][E, List[B]]

Attributes

Inherited from:
Applicative2
def flatTraverseAccumErrors[ColR <: (IterableOnce), ColIn <: (IterableOnce), ColL[_], E, A, B](col: ColR[A])(f: A => [_, _] =>> ZIO[R, _$1, _$2][ColL[E], ColIn[B]])(implicit buildR: Factory[B, ColR[B]], buildL: Factory[E, ColL[E]], iterL: ColL[E] => IterableOnce[E]): [_, _] =>> ZIO[R, _$1, _$2][ColL[E], ColR[B]]

flatTraverse with error accumulation

flatTraverse with error accumulation

Attributes

Inherited from:
ErrorAccumulatingOps2
final def forever[E, A](r: [_, _] =>> ZIO[R, _$1, _$2][E, A]): [_, _] =>> ZIO[R, _$1, _$2][E, Nothing]

Attributes

Inherited from:
Applicative2
final def fromFuture[A](mkFuture: => Future[A]): [_, _] =>> ZIO[R, _$1, _$2][Throwable, A]

Attributes

Inherited from:
WeakAsync2
def fromOption[E, A](errorOnNone: => E, r: [_, _] =>> ZIO[R, _$1, _$2][E, Option[A]]): [_, _] =>> ZIO[R, _$1, _$2][E, A]

Extracts the optional value or fails with the errorOnNone error

Extracts the optional value or fails with the errorOnNone error

Attributes

Inherited from:
Error2
override def fromSandboxExit[E, A](effect: => Uninterrupted[E, A]): [_, _] =>> ZIO[R, _$1, _$2][E, A]

Attributes

Definition Classes
IO2 -> Panic2
Inherited from:
IO2
final def guaranteeExceptOnInterrupt[E, A](f: [_, _] =>> ZIO[R, _$1, _$2][E, A], cleanupOnNonInterruption: Uninterrupted[E, A] => [_, _] =>> ZIO[R, _$1, _$2][Nothing, Unit]): [_, _] =>> ZIO[R, _$1, _$2][E, A]

Run cleanup on both success and failure, if the failure IS NOT an interruption.

Run cleanup on both success and failure, if the failure IS NOT an interruption.

Attributes

Inherited from:
Bracket2
final def guaranteeOnFailure[E, A](f: [_, _] =>> ZIO[R, _$1, _$2][E, A], cleanupOnFailure: Failure[E] => [_, _] =>> ZIO[R, _$1, _$2][Nothing, Unit]): [_, _] =>> ZIO[R, _$1, _$2][E, A]

Run cleanup only on a failure – any failure, INCLUDING interruption. Do not run cleanup if use finished successfully.

Run cleanup only on a failure – any failure, INCLUDING interruption. Do not run cleanup if use finished successfully.

Attributes

Inherited from:
Bracket2
final def guaranteeOnInterrupt[E, A](f: [_, _] =>> ZIO[R, _$1, _$2][E, A], cleanupOnInterruption: Interruption => [_, _] =>> ZIO[R, _$1, _$2][Nothing, Unit]): [_, _] =>> ZIO[R, _$1, _$2][E, A]

Run cleanup only on interruption. Do not run cleanup if use finished successfully.

Run cleanup only on interruption. Do not run cleanup if use finished successfully.

Attributes

Inherited from:
Bracket2
final def ifThenElse[E, E1, A](cond: [_, _] =>> ZIO[R, _$1, _$2][E, Boolean])(ifTrue: => [_, _] =>> ZIO[R, _$1, _$2][E1, A], ifFalse: => [_, _] =>> ZIO[R, _$1, _$2][E1, A])(implicit ev: E <:< E1): [_, _] =>> ZIO[R, _$1, _$2][E1, A]

Attributes

Inherited from:
Monad2
final def ifThenElse[E, A](cond: Boolean)(ifTrue: => [_, _] =>> ZIO[R, _$1, _$2][E, A], ifFalse: => [_, _] =>> ZIO[R, _$1, _$2][E, A]): [_, _] =>> ZIO[R, _$1, _$2][E, A]

Attributes

Inherited from:
Applicative2
final def ifThenFail[E](cond: Boolean)(errorIfTrue: => E): [_, _] =>> ZIO[R, _$1, _$2][E, Unit]

Attributes

Inherited from:
ApplicativeError2
def iterateUntilF[E, A](init: A)(f: A => [_, _] =>> ZIO[R, _$1, _$2][E, A])(p: A => Boolean): [_, _] =>> ZIO[R, _$1, _$2][E, A]

Apply an effectful function iteratively until its result satisfies the given predicate and return that result.

Apply an effectful function iteratively until its result satisfies the given predicate and return that result.

Attributes

Inherited from:
Monad2
def iterateWhileF[E, A](init: A)(f: A => [_, _] =>> ZIO[R, _$1, _$2][E, A])(p: A => Boolean): [_, _] =>> ZIO[R, _$1, _$2][E, A]

Apply an effectful function iteratively until its result fails to satisfy the given predicate and return that result.

Apply an effectful function iteratively until its result fails to satisfy the given predicate and return that result.

Attributes

Inherited from:
Monad2
final def orTerminate[A](r: [_, _] =>> ZIO[R, _$1, _$2][Throwable, A]): [_, _] =>> ZIO[R, _$1, _$2][Nothing, A]

Attributes

Inherited from:
Panic2
final def orTerminateK: Morphism1[[_] =>> [_, _] =>> ZIO[R, _$1, _$2][Throwable, _$5], [_] =>> [_, _] =>> ZIO[R, _$1, _$2][Nothing, _$6]]

Attributes

Inherited from:
Panic2
def parTraverseAccumErrors[ColL[_], E, A, B](col: Iterable[A])(f: A => [_, _] =>> ZIO[R, _$1, _$2][ColL[E], B])(implicit buildL: Factory[E, ColL[E]], iterL: ColL[E] => IterableOnce[E]): [_, _] =>> ZIO[R, _$1, _$2][ColL[E], List[B]]

Attributes

Inherited from:
ParallelErrorAccumulatingOps2
def parTraverseAccumErrors_[ColL[_], E, A](col: Iterable[A])(f: A => [_, _] =>> ZIO[R, _$1, _$2][ColL[E], Unit])(implicit buildL: Factory[E, ColL[E]], iterL: ColL[E] => IterableOnce[E]): [_, _] =>> ZIO[R, _$1, _$2][ColL[E], Unit]

Attributes

Inherited from:
ParallelErrorAccumulatingOps2
def partition[E, A](l: Iterable[[_, _] =>> ZIO[R, _$1, _$2][E, A]]): [_, _] =>> ZIO[R, _$1, _$2][Nothing, (List[E], List[A])]

Attributes

Inherited from:
Error2
final def sandboxCatchAll[E, A, E2](r: [_, _] =>> ZIO[R, _$1, _$2][E, A])(f: FailureUninterrupted[E] => [_, _] =>> ZIO[R, _$1, _$2][E2, A]): [_, _] =>> ZIO[R, _$1, _$2][E2, A]

Attributes

Inherited from:
Panic2
final def sandboxExit[E, A](r: [_, _] =>> ZIO[R, _$1, _$2][E, A]): [_, _] =>> ZIO[R, _$1, _$2][Nothing, Uninterrupted[E, A]]

Attributes

Note

Will return either Exit.Success, Exit.Error or Exit.Termination. Exit.Interruption cannot be sandboxed. Use guaranteeOnInterrupt for cleanups on interruptions.

Inherited from:
Panic2
def sequenceAccumErrors[ColR <: (IterableOnce), ColL[_], E, A](col: ColR[[_, _] =>> ZIO[R, _$1, _$2][ColL[E], A]])(implicit buildR: Factory[A, ColR[A]], buildL: Factory[E, ColL[E]], iterL: ColL[E] => IterableOnce[E]): [_, _] =>> ZIO[R, _$1, _$2][ColL[E], ColR[A]]

sequence with error accumulation

sequence with error accumulation

Attributes

Inherited from:
ErrorAccumulatingOps2
def sequenceAccumErrorsNEList[ColR <: (IterableOnce), E, A](col: ColR[[_, _] =>> ZIO[R, _$1, _$2][E, A]])(implicit buildR: Factory[A, ColR[A]]): [_, _] =>> ZIO[R, _$1, _$2][NEList[E], ColR[A]]

sequence with error accumulation

sequence with error accumulation

Attributes

Inherited from:
ErrorAccumulatingOps2
def sequenceAccumErrors_[ColR <: (IterableOnce), ColL[_], E, A](col: ColR[[_, _] =>> ZIO[R, _$1, _$2][ColL[E], A]])(implicit buildL: Factory[E, ColL[E]], iterL: ColL[E] => IterableOnce[E]): [_, _] =>> ZIO[R, _$1, _$2][ColL[E], Unit]

sequence_ with error accumulation

sequence_ with error accumulation

Attributes

Inherited from:
ErrorAccumulatingOps2
def tailRecM[E, A, B](a: A)(f: A => [_, _] =>> ZIO[R, _$1, _$2][E, Either[A, B]]): [_, _] =>> ZIO[R, _$1, _$2][E, B]

Attributes

Inherited from:
Monad2
final def traverse[E, A, B](o: Option[A])(f: A => [_, _] =>> ZIO[R, _$1, _$2][E, B]): [_, _] =>> ZIO[R, _$1, _$2][E, Option[B]]

Attributes

Inherited from:
Applicative2
def traverseAccumErrors[ColR <: (IterableOnce), ColL[_], E, A, B](col: ColR[A])(f: A => [_, _] =>> ZIO[R, _$1, _$2][ColL[E], B])(implicit buildR: Factory[B, ColR[B]], buildL: Factory[E, ColL[E]], iterL: ColL[E] => IterableOnce[E]): [_, _] =>> ZIO[R, _$1, _$2][ColL[E], ColR[B]]

traverse with error accumulation

traverse with error accumulation

Attributes

Inherited from:
ErrorAccumulatingOps2
def traverseAccumErrorsNEList[ColR <: (IterableOnce), E, A, B](col: ColR[A])(f: A => [_, _] =>> ZIO[R, _$1, _$2][E, B])(implicit buildR: Factory[B, ColR[B]]): [_, _] =>> ZIO[R, _$1, _$2][NEList[E], ColR[B]]

traverse with error accumulation

traverse with error accumulation

Attributes

Inherited from:
ErrorAccumulatingOps2
def traverseAccumErrors_[ColR <: (IterableOnce), ColL[_], E, A](col: ColR[A])(f: A => [_, _] =>> ZIO[R, _$1, _$2][ColL[E], Unit])(implicit buildL: Factory[E, ColL[E]], iterL: ColL[E] => IterableOnce[E]): [_, _] =>> ZIO[R, _$1, _$2][ColL[E], Unit]

traverse_ with error accumulation

traverse_ with error accumulation

Attributes

Inherited from:
ErrorAccumulatingOps2
final def unless[E, E1](cond: [_, _] =>> ZIO[R, _$1, _$2][E, Boolean])(ifFalse: => [_, _] =>> ZIO[R, _$1, _$2][E1, Unit])(implicit ev: E <:< E1): [_, _] =>> ZIO[R, _$1, _$2][E1, Unit]

Attributes

Inherited from:
Monad2
final def unless[E](cond: Boolean)(ifFalse: => [_, _] =>> ZIO[R, _$1, _$2][E, Unit]): [_, _] =>> ZIO[R, _$1, _$2][E, Unit]

Attributes

Inherited from:
Applicative2
final def when[E, E1](cond: [_, _] =>> ZIO[R, _$1, _$2][E, Boolean])(ifTrue: => [_, _] =>> ZIO[R, _$1, _$2][E1, Unit])(implicit ev: E <:< E1): [_, _] =>> ZIO[R, _$1, _$2][E1, Unit]

Attributes

Inherited from:
Monad2
final def when[E](cond: Boolean)(ifTrue: => [_, _] =>> ZIO[R, _$1, _$2][E, Unit]): [_, _] =>> ZIO[R, _$1, _$2][E, Unit]

Attributes

Inherited from:
Applicative2
final def widen[E, A, A1](r: [_, _] =>> ZIO[R, _$1, _$2][E, A])(implicit ev: A <:< A1): [_, _] =>> ZIO[R, _$1, _$2][E, A1]

Attributes

Inherited from:
Functor2
final def widenBoth[E, A, E1, A1](r: [_, _] =>> ZIO[R, _$1, _$2][E, A])(implicit ev: E <:< E1, ev2: A <:< A1): [_, _] =>> ZIO[R, _$1, _$2][E1, A1]

Attributes

Inherited from:
Bifunctor2
final def widenError[E, A, E1](r: [_, _] =>> ZIO[R, _$1, _$2][E, A])(implicit ev: E <:< E1): [_, _] =>> ZIO[R, _$1, _$2][E1, A]

Attributes

Inherited from:
Bifunctor2
final def withFilter[E, A](r: [_, _] =>> ZIO[R, _$1, _$2][E, A])(predicate: A => Boolean)(implicit filter: WithFilter[E], pos: SourceFilePositionMaterializer): [_, _] =>> ZIO[R, _$1, _$2][E, A]

for-comprehensions sugar:

for-comprehensions sugar:

 for {
   (1, 2) &lt;- F.pure((2, 1))
 } yield ()

Use widenError to for pattern matching with non-Throwable errors:

 val f = for {
   (1, 2) &lt;- F.pure((2, 1)).widenError[Option[Unit]]
 } yield ()
 // f: F[Option[Unit], Unit] = F.fail(Some(())

Attributes

Inherited from:
Error2
def zip[E, A, B](firstOp: [_, _] =>> ZIO[R, _$1, _$2][E, A], secondOp: => [_, _] =>> ZIO[R, _$1, _$2][E, B]): [_, _] =>> ZIO[R, _$1, _$2][E, (A, B)]

Attributes

Inherited from:
Applicative2

Deprecated and Inherited methods

final def asyncCancelable[E, A](register: (Either[E, A] => Unit) => InterruptAction[[_, _] =>> ZIO[R, _$1, _$2]]): [_, _] =>> ZIO[R, _$1, _$2][E, A]

Attributes

Deprecated
[Since version 1.3] renamed to asyncWithOnInterrupt
Inherited from:
Async2
def suspend[A](effect: => [_, _] =>> ZIO[R, _$1, _$2][Throwable, A]): [_, _] =>> ZIO[R, _$1, _$2][Throwable, A]

Attributes

Deprecated
[Since version 1.3] renamed to suspendThrowable
Inherited from:
IO2