object ZIO extends ZIOCompanionPlatformSpecific with Serializable
- Alphabetic
- By Inheritance
- ZIO
- Serializable
- Serializable
- ZIOCompanionPlatformSpecific
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
- final class Acquire[-R, +E, +A] extends AnyVal
- final class AcquireDiscard[-R, +E] extends AnyVal
- final class AcquireExit[-R, +E, +A] extends AnyVal
-
abstract
class
CanFilter[+E] extends AnyRef
- Annotations
- @implicitNotFound( ... )
- final class EnvironmentWithPartiallyApplied[R] extends AnyVal
- final class EnvironmentWithZIOPartiallyApplied[R] extends AnyVal
- final class GetStateWithPartiallyApplied[S] extends AnyVal
- final class Grafter extends AnyVal
- final class IfZIO[R, E] extends AnyVal
- final class InterruptStatusRestore extends AnyVal
- final class LogAnnotate extends AnyRef
- final class LogSpan extends AnyVal
- final class ProvideSomeLayer[R0, -R, +E, +A] extends AnyVal
- final class Release[-R, +E, +A] extends AnyRef
- final class ReleaseDiscard[-R, +E] extends AnyRef
- final class ReleaseExit[-R, +E, E1, +A, B] extends AnyRef
- final class ScopedPartiallyApplied[R] extends AnyVal
- final class ServiceAtPartiallyApplied[Service] extends AnyVal
- final class ServiceWithPartiallyApplied[Service] extends AnyVal
- final class ServiceWithZIOPartiallyApplied[Service] extends AnyVal
- final class TimeoutTo[-R, +E, +A, +B] extends AnyRef
- final class UnlessZIO[R, E] extends AnyVal
- final class UpdateService[-R, +E, +A, M] extends AnyVal
- final class UpdateServiceAt[-R, +E, +A, Service] extends AnyVal
- final class WhenZIO[R, E] extends AnyVal
- implicit final class ZIOAutoCloseableOps[R, E, A <: AutoCloseable] extends AnyVal
-
sealed
trait
ZIOConstructor[-Environment, +Error, In] extends AnyRef
A
ZIOConstructor[Input]
knows how to construct aZIO
value from an input of typeInput
.A
ZIOConstructor[Input]
knows how to construct aZIO
value from an input of typeInput
. This allows the type of theZIO
value constructed to depend onInput
. The constructedZIO
value is guaranteed not to require any services not included inEnvironment
or to be able to fail in any ways not described byError
. - trait ZIOConstructorLowPriority1 extends ZIOConstructorLowPriority2
- trait ZIOConstructorLowPriority2 extends ZIOConstructorLowPriority3
- trait ZIOConstructorLowPriority3 extends AnyRef
- implicit final class ZioRefineToOrDieOps[R, E <: Throwable, A] extends AnyVal
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
lazy val
Parallelism: FiberRef[Option[Int]]
The level of parallelism for parallel operators.
-
def
absolve[R, E, A](v: ⇒ ZIO[R, E, Either[E, A]])(implicit trace: ZTraceElement): ZIO[R, E, A]
Submerges the error case of an
Either
into theZIO
.Submerges the error case of an
Either
into theZIO
. The inverse operation ofIO.either
. -
def
acquireRelease[R, E, A](acquire: ⇒ ZIO[R, E, A])(release: (A) ⇒ ZIO[R, Nothing, Any])(implicit trace: ZTraceElement): ZIO[R with Scope, E, A]
Constructs a scoped resource from an
acquire
andrelease
effect.Constructs a scoped resource from an
acquire
andrelease
effect. Ifacquire
successfully completes execution thenrelease
will be added to the finalizers associated with the scope of this effect and is guaranteed to be run when the scope is closed.The
acquire
andrelease
effects will be run uninterruptibly. -
def
acquireReleaseExit[R, E, A](acquire: ⇒ ZIO[R, E, A])(release: (A, Exit[Any, Any]) ⇒ ZIO[R, Nothing, Any])(implicit trace: ZTraceElement): ZIO[R with Scope, E, A]
A more powerful variant of
acquireRelease
that allows therelease
effect to depend on theExit
value specified when the scope is closed. -
def
acquireReleaseExitWith[R, E, A, B](acquire: ⇒ ZIO[R, E, A], release: (A, Exit[E, B]) ⇒ URIO[R, Any], use: (A) ⇒ ZIO[R, E, B])(implicit trace: ZTraceElement): ZIO[R, E, B]
Uncurried version.
Uncurried version. Doesn't offer curried syntax and has worse type-inference characteristics, but guarantees no extra allocations of intermediate zio.ZIO.AcquireExit and zio.ZIO.ReleaseExit objects.
-
def
acquireReleaseExitWith[R, E, A](acquire: ⇒ ZIO[R, E, A]): AcquireExit[R, E, A]
Acquires a resource, uses the resource, and then releases the resource.
Acquires a resource, uses the resource, and then releases the resource. Neither the acquisition nor the release will be interrupted, and the resource is guaranteed to be released, so long as the
acquire
effect succeeds. Ifuse
fails, then after release, the returned effect will fail with the same error. -
def
acquireReleaseInterruptible[R, E, A](acquire: ⇒ ZIO[R, E, A])(release: ZIO[R, Nothing, Any])(implicit trace: ZTraceElement): ZIO[R with Scope, E, A]
A variant of
acquireRelease
that allows theacquire
effect to be interruptible.A variant of
acquireRelease
that allows theacquire
effect to be interruptible. Since theacquire
effect could be interrupted after partially acquiring resources, therelease
effect is not allowed to access the resource produced byacquire
and must independently determine what finalization, if any, needs to be performed (e.g. by examining in memory state). -
def
acquireReleaseInterruptibleExit[R, E, A](acquire: ⇒ ZIO[R, E, A])(release: (Exit[Any, Any]) ⇒ ZIO[R, Nothing, Any])(implicit trace: ZTraceElement): ZIO[R with Scope, E, A]
A more powerful variant of
acquireReleaseInterruptible
that allows therelease
effect to depend on theExit
value specified when the scope is closed. -
def
acquireReleaseWith[R, E, A, B](acquire: ⇒ ZIO[R, E, A], release: (A) ⇒ URIO[R, Any], use: (A) ⇒ ZIO[R, E, B])(implicit trace: ZTraceElement): ZIO[R, E, B]
Uncurried version.
Uncurried version. Doesn't offer curried syntax and have worse type-inference characteristics, but guarantees no extra allocations of intermediate zio.ZIO.Acquire and zio.ZIO.Release objects.
-
def
acquireReleaseWith[R, E, A](acquire: ⇒ ZIO[R, E, A]): Acquire[R, E, A]
When this effect represents acquisition of a resource (for example, opening a file, launching a thread, etc.),
acquireReleaseWith
can be used to ensure the acquisition is not interrupted and the resource is always released.When this effect represents acquisition of a resource (for example, opening a file, launching a thread, etc.),
acquireReleaseWith
can be used to ensure the acquisition is not interrupted and the resource is always released.The function does two things:
- Ensures this effect, which acquires the resource, will not be
interrupted. Of course, acquisition may fail for internal reasons (an
uncaught exception). 2. Ensures the
release
effect will not be interrupted, and will be executed so long as this effect successfully acquires the resource.
In between acquisition and release of the resource, the
use
effect is executed.If the
release
effect fails, then the entire effect will fail even if theuse
effect succeeds. If this fail-fast behavior is not desired, errors produced by therelease
effect can be caught and ignored.openFile("data.json").acquireReleaseWith(closeFile) { file => for { header <- readHeader(file) ... } yield result }
- Ensures this effect, which acquires the resource, will not be
interrupted. Of course, acquisition may fail for internal reasons (an
uncaught exception). 2. Ensures the
-
def
addFinalizer[R](finalizer: ⇒ URIO[R, Any])(implicit trace: ZTraceElement): ZIO[R with Scope, Nothing, Any]
Adds a finalizer to the scope of this effect.
Adds a finalizer to the scope of this effect. The finalizer is guaranteed to be run when the scope is closed.
-
def
addFinalizerExit[R](finalizer: (Exit[Any, Any]) ⇒ URIO[R, Any])(implicit trace: ZTraceElement): ZIO[R with Scope, Nothing, Any]
A more powerful variant of
addFinalizer
that allows the finalizer to depend on theExit
value that the scope is closed with. -
def
allowInterrupt(implicit trace: ZTraceElement): UIO[Unit]
Makes an explicit check to see if the fiber has been interrupted, and if so, performs self-interruption
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
async[R, E, A](register: ((ZIO[R, E, A]) ⇒ Unit) ⇒ Any, blockingOn: ⇒ FiberId = FiberId.None)(implicit trace: ZTraceElement): ZIO[R, E, A]
Imports an asynchronous side-effect into a pure
ZIO
value.Imports an asynchronous side-effect into a pure
ZIO
value. SeeasyncMaybe
for the more expressive variant of this function that can return a value synchronously.The callback function
ZIO[R, E, A] => Any
must be called at most once.The list of fibers, that may complete the async callback, is used to provide better diagnostics.
-
def
asyncInterrupt[R, E, A](register: ((ZIO[R, E, A]) ⇒ Unit) ⇒ Either[Canceler[R], ZIO[R, E, A]], blockingOn: ⇒ FiberId = FiberId.None)(implicit trace: ZTraceElement): ZIO[R, E, A]
Imports an asynchronous side-effect into a ZIO effect.
Imports an asynchronous side-effect into a ZIO effect. The side-effect has the option of returning the value synchronously, which is useful in cases where it cannot be determined if the effect is synchronous or asynchronous until the side-effect is actually executed. The effect also has the option of returning a canceler, which will be used by the runtime to cancel the asynchronous effect if the fiber executing the effect is interrupted.
If the register function returns a value synchronously, then the callback function
ZIO[R, E, A] => Any
must not be called. Otherwise the callback function must be called at most once.The list of fibers, that may complete the async callback, is used to provide better diagnostics.
-
def
asyncMaybe[R, E, A](register: ((ZIO[R, E, A]) ⇒ Unit) ⇒ Option[ZIO[R, E, A]], blockingOn: ⇒ FiberId = FiberId.None)(implicit trace: ZTraceElement): ZIO[R, E, A]
Imports an asynchronous effect into a pure
ZIO
value, possibly returning the value synchronously.Imports an asynchronous effect into a pure
ZIO
value, possibly returning the value synchronously.If the register function returns a value synchronously, then the callback function
ZIO[R, E, A] => Any
must not be called. Otherwise the callback function must be called at most once.The list of fibers, that may complete the async callback, is used to provide better diagnostics.
-
def
asyncZIO[R, E, A](register: ((ZIO[R, E, A]) ⇒ Unit) ⇒ ZIO[R, E, Any])(implicit trace: ZTraceElement): ZIO[R, E, A]
Imports an asynchronous effect into a pure
ZIO
value.Imports an asynchronous effect into a pure
ZIO
value. This formulation is necessary when the effect is itself expressed in terms ofZIO
. -
def
attempt[A](effect: ⇒ A)(implicit trace: ZTraceElement): Task[A]
Imports a synchronous side-effect into a pure
ZIO
value, translating any thrown exceptions into typed failed effects creating withZIO.fail
.Imports a synchronous side-effect into a pure
ZIO
value, translating any thrown exceptions into typed failed effects creating withZIO.fail
.def printLine(line: String): Task[Unit] = Task.attempt(println(line))
-
def
attemptBlocking[A](effect: ⇒ A)(implicit trace: ZTraceElement): Task[A]
Imports a synchronous effect that does blocking IO into a pure value.
-
def
attemptBlockingCancelable[R, A](effect: ⇒ A)(cancel: ⇒ URIO[R, Any])(implicit trace: ZTraceElement): RIO[R, A]
Imports a synchronous effect that does blocking IO into a pure value, with a custom cancel effect.
Imports a synchronous effect that does blocking IO into a pure value, with a custom cancel effect.
If the returned
ZIO
is interrupted, the blocked thread running the synchronous effect will be interrupted via the cancel effect. -
def
attemptBlockingIO[A](effect: ⇒ A)(implicit trace: ZTraceElement): IO[IOException, A]
Imports a synchronous effect that does blocking IO into a pure value, refining the error type to
java.io.IOException
. -
def
attemptBlockingInterrupt[A](effect: ⇒ A)(implicit trace: ZTraceElement): Task[A]
Imports a synchronous effect that does blocking IO into a pure value.
Imports a synchronous effect that does blocking IO into a pure value.
If the returned
ZIO
is interrupted, the blocked thread running the synchronous effect will be interrupted viaThread.interrupt
.Note that this adds significant overhead. For performance sensitive applications consider using
attemptBlocking
orattemptBlockingCancelable
.- Definition Classes
- ZIOCompanionPlatformSpecific
-
def
blocking[R, E, A](zio: ⇒ ZIO[R, E, A])(implicit trace: ZTraceElement): ZIO[R, E, A]
Locks the specified effect to the blocking thread pool.
-
def
blockingExecutor(implicit trace: ZTraceElement): UIO[Executor]
Retrieves the executor for all blocking tasks.
-
def
checkInterruptible[R, E, A](f: (zio.InterruptStatus) ⇒ ZIO[R, E, A])(implicit trace: ZTraceElement): ZIO[R, E, A]
Checks the interrupt status, and produces the effect returned by the specified callback.
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
collect[R, E, Key, Key2, Value, Value2](map: Map[Key, Value])(f: (Key, Value) ⇒ ZIO[R, Option[E], (Key2, Value2)])(implicit trace: ZTraceElement): ZIO[R, E, Map[Key2, Value2]]
Evaluate each effect in the structure from left to right, collecting the the successful values and discarding the empty cases.
Evaluate each effect in the structure from left to right, collecting the the successful values and discarding the empty cases. For a parallel version, see
collectPar
. -
def
collect[R, E, A, B, Collection[+Element] <: Iterable[Element]](in: Collection[A])(f: (A) ⇒ ZIO[R, Option[E], B])(implicit bf: zio.BuildFrom[Collection[A], B, Collection[B]], trace: ZTraceElement): ZIO[R, E, Collection[B]]
Evaluate each effect in the structure from left to right, collecting the the successful values and discarding the empty cases.
Evaluate each effect in the structure from left to right, collecting the the successful values and discarding the empty cases. For a parallel version, see
collectPar
. -
def
collectAll[R, E, A](in: NonEmptyChunk[ZIO[R, E, A]])(implicit trace: ZTraceElement): ZIO[R, E, NonEmptyChunk[A]]
Evaluate each effect in the structure from left to right, and collect the results.
Evaluate each effect in the structure from left to right, and collect the results. For a parallel version, see
collectAllPar
. -
def
collectAll[R, E, A](in: Option[ZIO[R, E, A]])(implicit trace: ZTraceElement): ZIO[R, E, Option[A]]
Evaluate effect if present, and return its result as
Option[A]
. -
def
collectAll[R, E, A](in: Array[ZIO[R, E, A]])(implicit arg0: ClassTag[A], trace: ZTraceElement): ZIO[R, E, Array[A]]
Evaluate each effect in the structure from left to right, and collect the results.
Evaluate each effect in the structure from left to right, and collect the results. For a parallel version, see
collectAllPar
. -
def
collectAll[R, E, A](in: Set[ZIO[R, E, A]])(implicit trace: ZTraceElement): ZIO[R, E, Set[A]]
Evaluate each effect in the structure from left to right, and collect the results.
Evaluate each effect in the structure from left to right, and collect the results. For a parallel version, see
collectAllPar
. -
def
collectAll[R, E, A, Collection[+Element] <: Iterable[Element]](in: Collection[ZIO[R, E, A]])(implicit bf: zio.BuildFrom[Collection[ZIO[R, E, A]], A, Collection[A]], trace: ZTraceElement): ZIO[R, E, Collection[A]]
Evaluate each effect in the structure from left to right, and collect the results.
Evaluate each effect in the structure from left to right, and collect the results. For a parallel version, see
collectAllPar
. -
def
collectAllDiscard[R, E, A](in: ⇒ Iterable[ZIO[R, E, A]])(implicit trace: ZTraceElement): ZIO[R, E, Unit]
Evaluate each effect in the structure from left to right, and discard the results.
Evaluate each effect in the structure from left to right, and discard the results. For a parallel version, see
collectAllParDiscard
. -
def
collectAllPar[R, E, A](as: NonEmptyChunk[ZIO[R, E, A]])(implicit trace: ZTraceElement): ZIO[R, E, NonEmptyChunk[A]]
Evaluate each effect in the structure in parallel, and collect the results.
Evaluate each effect in the structure in parallel, and collect the results. For a sequential version, see
collectAll
. -
def
collectAllPar[R, E, A](as: Array[ZIO[R, E, A]])(implicit arg0: ClassTag[A], trace: ZTraceElement): ZIO[R, E, Array[A]]
Evaluate each effect in the structure in parallel, and collect the results.
Evaluate each effect in the structure in parallel, and collect the results. For a sequential version, see
collectAll
. -
def
collectAllPar[R, E, A](as: Set[ZIO[R, E, A]])(implicit trace: ZTraceElement): ZIO[R, E, Set[A]]
Evaluate each effect in the structure in parallel, and collect the results.
Evaluate each effect in the structure in parallel, and collect the results. For a sequential version, see
collectAll
. -
def
collectAllPar[R, E, A, Collection[+Element] <: Iterable[Element]](as: Collection[ZIO[R, E, A]])(implicit bf: zio.BuildFrom[Collection[ZIO[R, E, A]], A, Collection[A]], trace: ZTraceElement): ZIO[R, E, Collection[A]]
Evaluate each effect in the structure in parallel, and collect the results.
Evaluate each effect in the structure in parallel, and collect the results. For a sequential version, see
collectAll
. -
def
collectAllParDiscard[R, E, A](as: ⇒ Iterable[ZIO[R, E, A]])(implicit trace: ZTraceElement): ZIO[R, E, Unit]
Evaluate each effect in the structure in parallel, and discard the results.
Evaluate each effect in the structure in parallel, and discard the results. For a sequential version, see
collectAllDiscard
. -
def
collectAllSuccesses[R, E, A, Collection[+Element] <: Iterable[Element]](in: Collection[ZIO[R, E, A]])(implicit bf: zio.BuildFrom[Collection[ZIO[R, E, A]], A, Collection[A]], trace: ZTraceElement): URIO[R, Collection[A]]
Evaluate and run each effect in the structure and collect discarding failed ones.
-
def
collectAllSuccessesPar[R, E, A, Collection[+Element] <: Iterable[Element]](in: Collection[ZIO[R, E, A]])(implicit bf: zio.BuildFrom[Collection[ZIO[R, E, A]], A, Collection[A]], trace: ZTraceElement): URIO[R, Collection[A]]
Evaluate and run each effect in the structure in parallel, and collect discarding failed ones.
-
def
collectAllWith[R, E, A, B, Collection[+Element] <: Iterable[Element]](in: Collection[ZIO[R, E, A]])(f: PartialFunction[A, B])(implicit bf: zio.BuildFrom[Collection[ZIO[R, E, A]], B, Collection[B]], trace: ZTraceElement): ZIO[R, E, Collection[B]]
Evaluate each effect in the structure with
collectAll
, and collect the results with given partial function. -
def
collectAllWithPar[R, E, A, U, Collection[+Element] <: Iterable[Element]](in: Collection[ZIO[R, E, A]])(f: PartialFunction[A, U])(implicit bf: zio.BuildFrom[Collection[ZIO[R, E, A]], U, Collection[U]], trace: ZTraceElement): ZIO[R, E, Collection[U]]
Evaluate each effect in the structure with
collectAllPar
, and collect the results with given partial function. -
def
collectFirst[R, E, A, B](as: ⇒ Iterable[A])(f: (A) ⇒ ZIO[R, E, Option[B]])(implicit trace: ZTraceElement): ZIO[R, E, Option[B]]
Collects the first element of the
Iterable[A]
for which the effectual functionf
returnsSome
. -
def
collectPar[R, E, Key, Key2, Value, Value2](map: Map[Key, Value])(f: (Key, Value) ⇒ ZIO[R, Option[E], (Key2, Value2)])(implicit trace: ZTraceElement): ZIO[R, E, Map[Key2, Value2]]
Evaluate each effect in the structure from left to right, collecting the the successful values and discarding the empty cases.
Evaluate each effect in the structure from left to right, collecting the the successful values and discarding the empty cases. For a parallel version, see
collectPar
. -
def
collectPar[R, E, A, B, Collection[+Element] <: Iterable[Element]](in: Collection[A])(f: (A) ⇒ ZIO[R, Option[E], B])(implicit bf: zio.BuildFrom[Collection[A], B, Collection[B]], trace: ZTraceElement): ZIO[R, E, Collection[B]]
Evaluate each effect in the structure in parallel, collecting the the successful values and discarding the empty cases.
-
def
cond[E, A](predicate: ⇒ Boolean, result: ⇒ A, error: ⇒ E)(implicit trace: ZTraceElement): IO[E, A]
Similar to Either.cond, evaluate the predicate, return the given A as success if predicate returns true, and the given E as error otherwise
Similar to Either.cond, evaluate the predicate, return the given A as success if predicate returns true, and the given E as error otherwise
For effectful conditionals, see ZIO.ifZIO
-
def
debug(value: ⇒ Any)(implicit trace: ZTraceElement): UIO[Unit]
Prints the specified message to the console for debugging purposes.
-
def
descriptor(implicit trace: ZTraceElement): UIO[Fiber.Descriptor]
Returns information about the current fiber, such as its identity.
-
def
descriptorWith[R, E, A](f: (Fiber.Descriptor) ⇒ ZIO[R, E, A])(implicit trace: ZTraceElement): ZIO[R, E, A]
Constructs an effect based on information about the current fiber, such as its identity.
-
def
die(t: ⇒ Throwable)(implicit trace: ZTraceElement): UIO[Nothing]
Returns an effect that dies with the specified
Throwable
.Returns an effect that dies with the specified
Throwable
. This method can be used for terminating a fiber because a defect has been detected in the code. -
def
dieMessage(message: ⇒ String)(implicit trace: ZTraceElement): UIO[Nothing]
Returns an effect that dies with a java.lang.RuntimeException having the specified text message.
Returns an effect that dies with a java.lang.RuntimeException having the specified text message. This method can be used for terminating a fiber because a defect has been detected in the code.
-
def
done[E, A](r: ⇒ Exit[E, A])(implicit trace: ZTraceElement): IO[E, A]
Returns an effect from a zio.Exit value.
-
def
environment[R](implicit trace: ZTraceElement): URIO[R, ZEnvironment[R]]
Accesses the whole environment of the effect.
-
def
environmentWith[R]: EnvironmentWithPartiallyApplied[R]
Accesses the environment of the effect.
-
def
environmentWithZIO[R]: EnvironmentWithZIOPartiallyApplied[R]
Effectually accesses the environment of the effect.
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
executor(implicit trace: ZTraceElement): UIO[Executor]
Retrieves the executor for this effect.
-
def
exists[R, E, A](as: ⇒ Iterable[A])(f: (A) ⇒ ZIO[R, E, Boolean])(implicit trace: ZTraceElement): ZIO[R, E, Boolean]
Determines whether any element of the
Iterable[A]
satisfies the effectual predicatef
. -
def
fail[E](error: ⇒ E)(implicit trace: ZTraceElement): IO[E, Nothing]
Returns an effect that models failure with the specified error.
Returns an effect that models failure with the specified error. The moral equivalent of
throw
for pure code. -
def
failCause[E](cause: ⇒ Cause[E])(implicit trace: ZTraceElement): IO[E, Nothing]
Returns an effect that models failure with the specified
Cause
. -
def
fiberId(implicit trace: ZTraceElement): UIO[FiberId]
Returns the
FiberId
of the fiber executing the effect that calls this method. -
def
filter[R, E, A](as: Set[A])(f: (A) ⇒ ZIO[R, E, Boolean])(implicit trace: ZTraceElement): ZIO[R, E, Set[A]]
Filters the Set[A] using the specified effectual predicate.
-
def
filter[R, E, A, Collection[+Element] <: Iterable[Element]](as: Collection[A])(f: (A) ⇒ ZIO[R, E, Boolean])(implicit bf: zio.BuildFrom[Collection[A], A, Collection[A]], trace: ZTraceElement): ZIO[R, E, Collection[A]]
Filters the collection using the specified effectual predicate.
-
def
filterNot[R, E, A](as: Set[A])(f: (A) ⇒ ZIO[R, E, Boolean])(implicit trace: ZTraceElement): ZIO[R, E, Set[A]]
Filters the Set[A] using the specified effectual predicate, removing all elements that satisfy the predicate.
-
def
filterNot[R, E, A, Collection[+Element] <: Iterable[Element]](as: Collection[A])(f: (A) ⇒ ZIO[R, E, Boolean])(implicit bf: zio.BuildFrom[Collection[A], A, Collection[A]], trace: ZTraceElement): ZIO[R, E, Collection[A]]
Filters the collection using the specified effectual predicate, removing all elements that satisfy the predicate.
-
def
filterNotPar[R, E, A](as: Set[A])(f: (A) ⇒ ZIO[R, E, Boolean])(implicit trace: ZTraceElement): ZIO[R, E, Set[A]]
Filters the Set[A] in parallel using the specified effectual predicate, removing all elements that satisfy the predicate.
Filters the Set[A] in parallel using the specified effectual predicate, removing all elements that satisfy the predicate.
See zio.ZIO.filterNot[R,E,A](as:Set* for a sequential version.
-
def
filterNotPar[R, E, A, Collection[+Element] <: Iterable[Element]](as: Collection[A])(f: (A) ⇒ ZIO[R, E, Boolean])(implicit bf: zio.BuildFrom[Collection[A], A, Collection[A]], trace: ZTraceElement): ZIO[R, E, Collection[A]]
Filters the collection in parallel using the specified effectual predicate, emoving all elements that satisfy the predicate.
Filters the collection in parallel using the specified effectual predicate, emoving all elements that satisfy the predicate.
See zio.ZIO.filterNot[R,E,A,Collection* for a sequential version.
-
def
filterPar[R, E, A](as: Set[A])(f: (A) ⇒ ZIO[R, E, Boolean])(implicit trace: ZTraceElement): ZIO[R, E, Set[A]]
Filters the Set[A] in parallel using the specified effectual predicate.
Filters the Set[A] in parallel using the specified effectual predicate.
See zio.ZIO.filter[R,E,A,Collection* for a sequential version.
-
def
filterPar[R, E, A, Collection[+Element] <: Iterable[Element]](as: Collection[A])(f: (A) ⇒ ZIO[R, E, Boolean])(implicit bf: zio.BuildFrom[Collection[A], A, Collection[A]], trace: ZTraceElement): ZIO[R, E, Collection[A]]
Filters the collection in parallel using the specified effectual predicate.
Filters the collection in parallel using the specified effectual predicate.
See zio.ZIO.filter[R,E,A,Collection* for a sequential version.
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
firstSuccessOf[R, R1 <: R, E, A](zio: ⇒ ZIO[R, E, A], rest: ⇒ Iterable[ZIO[R1, E, A]])(implicit trace: ZTraceElement): ZIO[R1, E, A]
Returns an effect that runs the first effect and in case of failure, runs each of the specified effects in order until one of them succeeds.
-
def
flatten[R, E, A](zio: ⇒ ZIO[R, E, ZIO[R, E, A]])(implicit trace: ZTraceElement): ZIO[R, E, A]
Returns an effect that first executes the outer effect, and then executes the inner effect, returning the value from the inner effect, and effectively flattening a nested effect.
-
def
foldLeft[R, E, S, A](in: ⇒ Iterable[A])(zero: ⇒ S)(f: (S, A) ⇒ ZIO[R, E, S])(implicit trace: ZTraceElement): ZIO[R, E, S]
Folds an Iterable[A] using an effectual function f, working sequentially from left to right.
-
def
foldRight[R, E, S, A](in: ⇒ Iterable[A])(zero: ⇒ S)(f: (A, S) ⇒ ZIO[R, E, S])(implicit trace: ZTraceElement): ZIO[R, E, S]
Folds an Iterable[A] using an effectual function f, working sequentially from right to left.
-
def
forall[R, E, A](as: ⇒ Iterable[A])(f: (A) ⇒ ZIO[R, E, Boolean])(implicit trace: ZTraceElement): ZIO[R, E, Boolean]
Determines whether all elements of the
Iterable[A]
satisfy the effectual predicatef
. -
final
def
foreach[R, E, A, B](in: NonEmptyChunk[A])(f: (A) ⇒ ZIO[R, E, B])(implicit trace: ZTraceElement): ZIO[R, E, NonEmptyChunk[B]]
Applies the function
f
to each element of theNonEmptyChunk[A]
and returns the results in a newNonEmptyChunk[B]
.Applies the function
f
to each element of theNonEmptyChunk[A]
and returns the results in a newNonEmptyChunk[B]
.For a parallel version of this method, see
foreachPar
. If you do not need the results, seeforeachDiscard
for a more efficient implementation. -
final
def
foreach[R, E, A, B](in: Option[A])(f: (A) ⇒ ZIO[R, E, B])(implicit trace: ZTraceElement): ZIO[R, E, Option[B]]
Applies the function
f
if the argument is non-empty and returns the results in a newOption[B]
. -
def
foreach[R, E, Key, Key2, Value, Value2](map: Map[Key, Value])(f: (Key, Value) ⇒ ZIO[R, E, (Key2, Value2)])(implicit trace: ZTraceElement): ZIO[R, E, Map[Key2, Value2]]
Applies the function
f
to each element of theMap[Key, Value]
and returns the results in a newMap[Key2, Value2]
.Applies the function
f
to each element of theMap[Key, Value]
and returns the results in a newMap[Key2, Value2]
.For a parallel version of this method, see
foreachPar
. If you do not need the results, seeforeachDiscard
for a more efficient implementation. -
final
def
foreach[R, E, A, B](in: Array[A])(f: (A) ⇒ ZIO[R, E, B])(implicit arg0: ClassTag[B], trace: ZTraceElement): ZIO[R, E, Array[B]]
Applies the function
f
to each element of theArray[A]
and returns the results in a newArray[B]
.Applies the function
f
to each element of theArray[A]
and returns the results in a newArray[B]
.For a parallel version of this method, see
foreachPar
. If you do not need the results, seeforeachDiscard
for a more efficient implementation. -
final
def
foreach[R, E, A, B](in: Set[A])(f: (A) ⇒ ZIO[R, E, B])(implicit trace: ZTraceElement): ZIO[R, E, Set[B]]
Applies the function
f
to each element of theSet[A]
and returns the results in a newSet[B]
.Applies the function
f
to each element of theSet[A]
and returns the results in a newSet[B]
.For a parallel version of this method, see
foreachPar
. If you do not need the results, seeforeachDiscard
for a more efficient implementation. -
def
foreach[R, E, A, B, Collection[+Element] <: Iterable[Element]](in: Collection[A])(f: (A) ⇒ ZIO[R, E, B])(implicit bf: zio.BuildFrom[Collection[A], B, Collection[B]], trace: ZTraceElement): ZIO[R, E, Collection[B]]
Applies the function
f
to each element of theCollection[A]
and returns the results in a newCollection[B]
.Applies the function
f
to each element of theCollection[A]
and returns the results in a newCollection[B]
.For a parallel version of this method, see
foreachPar
. If you do not need the results, seeforeach_
for a more efficient implementation. -
def
foreachDiscard[R, E, A](as: ⇒ Iterable[A])(f: (A) ⇒ ZIO[R, E, Any])(implicit trace: ZTraceElement): ZIO[R, E, Unit]
Applies the function
f
to each element of theIterable[A]
and runs produced effects sequentially.Applies the function
f
to each element of theIterable[A]
and runs produced effects sequentially.Equivalent to
foreach(as)(f).unit
, but without the cost of building the list of results. -
final
def
foreachExec[R, E, A, B, Collection[+Element] <: Iterable[Element]](as: Collection[A])(exec: ⇒ ExecutionStrategy)(f: (A) ⇒ ZIO[R, E, B])(implicit bf: zio.BuildFrom[Collection[A], B, Collection[B]], trace: ZTraceElement): ZIO[R, E, Collection[B]]
Applies the function
f
to each element of theCollection[A]
and returns the result in a newCollection[B]
using the specified execution strategy. -
final
def
foreachPar[R, E, A, B](as: NonEmptyChunk[A])(fn: (A) ⇒ ZIO[R, E, B])(implicit trace: ZTraceElement): ZIO[R, E, NonEmptyChunk[B]]
Applies the function
f
to each element of theNonEmptyChunk[A]
in parallel, and returns the results in a newNonEmptyChunk[B]
.Applies the function
f
to each element of theNonEmptyChunk[A]
in parallel, and returns the results in a newNonEmptyChunk[B]
.For a sequential version of this method, see
foreach
. -
def
foreachPar[R, E, Key, Key2, Value, Value2](map: Map[Key, Value])(f: (Key, Value) ⇒ ZIO[R, E, (Key2, Value2)])(implicit trace: ZTraceElement): ZIO[R, E, Map[Key2, Value2]]
Applies the function
f
to each element of theMap[Key, Value]
in parallel and returns the results in a newMap[Key2, Value2]
.Applies the function
f
to each element of theMap[Key, Value]
in parallel and returns the results in a newMap[Key2, Value2]
.For a sequential version of this method, see
foreach
. -
final
def
foreachPar[R, E, A, B](as: Array[A])(f: (A) ⇒ ZIO[R, E, B])(implicit arg0: ClassTag[B], trace: ZTraceElement): ZIO[R, E, Array[B]]
Applies the function
f
to each element of theArray[A]
in parallel, and returns the results in a newArray[B]
.Applies the function
f
to each element of theArray[A]
in parallel, and returns the results in a newArray[B]
.For a sequential version of this method, see
foreach
. -
final
def
foreachPar[R, E, A, B](as: Set[A])(fn: (A) ⇒ ZIO[R, E, B])(implicit trace: ZTraceElement): ZIO[R, E, Set[B]]
Applies the function
f
to each element of theSet[A]
in parallel, and returns the results in a newSet[B]
.Applies the function
f
to each element of theSet[A]
in parallel, and returns the results in a newSet[B]
.For a sequential version of this method, see
foreach
. -
def
foreachPar[R, E, A, B, Collection[+Element] <: Iterable[Element]](as: Collection[A])(f: (A) ⇒ ZIO[R, E, B])(implicit bf: zio.BuildFrom[Collection[A], B, Collection[B]], trace: ZTraceElement): ZIO[R, E, Collection[B]]
Applies the function
f
to each element of theCollection[A]
in parallel, and returns the results in a newCollection[B]
.Applies the function
f
to each element of theCollection[A]
in parallel, and returns the results in a newCollection[B]
.For a sequential version of this method, see
foreach
. -
def
foreachParDiscard[R, E, A](as: ⇒ Iterable[A])(f: (A) ⇒ ZIO[R, E, Any])(implicit trace: ZTraceElement): ZIO[R, E, Unit]
Applies the function
f
to each element of theIterable[A]
and runs produced effects in parallel, discarding the results.Applies the function
f
to each element of theIterable[A]
and runs produced effects in parallel, discarding the results.For a sequential version of this method, see
foreachDiscard
.Optimized to avoid keeping full tree of effects, so that method could be able to handle large input sequences. Behaves almost like this code:
as.foldLeft(ZIO.unit) { (acc, a) => acc.zipParLeft(f(a)) }
Additionally, interrupts all effects on any failure.
-
def
forkAll[R, E, A, Collection[+Element] <: Iterable[Element]](as: Collection[ZIO[R, E, A]])(implicit bf: zio.BuildFrom[Collection[ZIO[R, E, A]], A, Collection[A]], trace: ZTraceElement): URIO[R, Fiber[E, Collection[A]]]
Returns an effect that forks all of the specified values, and returns a composite fiber that produces a list of their results, in order.
-
def
forkAllDiscard[R, E, A](as: ⇒ Iterable[ZIO[R, E, A]])(implicit trace: ZTraceElement): URIO[R, Unit]
Returns an effect that forks all of the specified values, and returns a composite fiber that produces unit.
Returns an effect that forks all of the specified values, and returns a composite fiber that produces unit. This version is faster than forkAll in cases where the results of the forked fibers are not needed.
-
def
from[Input](input: ⇒ Input)(implicit constructor: ZIOConstructor[Nothing, Any, Input], trace: ZTraceElement): ZIO[OutEnvironment, OutError, OutSuccess]
Constructs a
ZIO
value of the appropriate type for the specified input. - def fromAutoCloseable[R, E, A <: AutoCloseable](fa: ⇒ ZIO[R, E, A])(implicit trace: ZTraceElement): ZIO[R with Scope, E, A]
-
def
fromEither[E, A](v: ⇒ Either[E, A])(implicit trace: ZTraceElement): IO[E, A]
Lifts an
Either
into aZIO
value. -
def
fromEitherCause[E, A](v: ⇒ Either[Cause[E], A])(implicit trace: ZTraceElement): IO[E, A]
Lifts an
Either
into aZIO
value. -
def
fromFiber[E, A](fiber: ⇒ Fiber[E, A])(implicit trace: ZTraceElement): IO[E, A]
Creates a
ZIO
value that represents the exit value of the specified fiber. -
def
fromFiberZIO[R, E, A](fiber: ⇒ ZIO[R, E, Fiber[E, A]])(implicit trace: ZTraceElement): ZIO[R, E, A]
Creates a
ZIO
value that represents the exit value of the specified fiber. -
def
fromFuture[A](make: (ExecutionContext) ⇒ Future[A])(implicit trace: ZTraceElement): Task[A]
Imports a function that creates a scala.concurrent.Future from an scala.concurrent.ExecutionContext into a
ZIO
. -
def
fromFutureInterrupt[A](make: (ExecutionContext) ⇒ Future[A])(implicit trace: ZTraceElement): Task[A]
Imports a function that creates a scala.concurrent.Future from an scala.concurrent.ExecutionContext into a
ZIO
.Imports a function that creates a scala.concurrent.Future from an scala.concurrent.ExecutionContext into a
ZIO
. The providedExecutionContext
will interrupt theFuture
between asynchronous operations such asmap
andflatMap
if this effect is interrupted. Note that no attempt will be made to interrupt aFuture
blocking on a synchronous operation and that theFuture
must be created using the providedExecutionContext
. -
def
fromOption[A](v: ⇒ Option[A])(implicit trace: ZTraceElement): IO[Option[Nothing], A]
Lifts an
Option
into aZIO
but preserves the error as an option in the error channel, making it easier to compose in some scenarios. -
def
fromPromiseJS[A](promise: ⇒ scala.scalajs.js.Promise[A])(implicit trace: ZTraceElement): Task[A]
Imports a Scala.js promise into a
ZIO
.Imports a Scala.js promise into a
ZIO
.- Definition Classes
- ZIOCompanionPlatformSpecific
-
def
fromPromiseScala[A](promise: ⇒ scala.concurrent.Promise[A])(implicit trace: ZTraceElement): Task[A]
Imports a scala.concurrent.Promise we generate a future from promise, and we pass to [fromFuture] to transform into Task[A]
-
def
fromTry[A](value: ⇒ Try[A])(implicit trace: ZTraceElement): Task[A]
Lifts a
Try
into aZIO
. -
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
getFiberRefs(implicit trace: ZTraceElement): UIO[FiberRefs]
Returns a collection of all
FiberRef
values for the fiber running this effect. -
final
def
getOrFail[A](v: ⇒ Option[A])(implicit trace: ZTraceElement): Task[A]
Lifts an Option into a ZIO, if the option is not defined it fails with NoSuchElementException.
-
final
def
getOrFailUnit[A](v: ⇒ Option[A])(implicit trace: ZTraceElement): IO[Unit, A]
Lifts an Option into a IO, if the option is not defined it fails with Unit.
-
final
def
getOrFailWith[E, A](e: ⇒ E)(v: ⇒ Option[A])(implicit trace: ZTraceElement): IO[E, A]
Lifts an Option into a ZIO.
Lifts an Option into a ZIO. If the option is not defined, fail with the
e
value. -
def
getState[S](implicit arg0: zio.EnvironmentTag[S], trace: ZTraceElement): ZIO[ZState[S], Nothing, S]
Gets a state from the environment.
-
def
getStateWith[S]: GetStateWithPartiallyApplied[S]
Gets a state from the environment and uses it to run the specified function.
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
ifZIO[R, E](b: ⇒ ZIO[R, E, Boolean]): IfZIO[R, E]
Runs
onTrue
if the result ofb
istrue
andonFalse
otherwise. -
val
infinity: URIO[Clock, Nothing]
Like never, but fibers that running this effect won't be garbage collected unless interrupted.
-
def
interrupt(implicit trace: ZTraceElement): UIO[Nothing]
Returns an effect that is interrupted as if by the fiber calling this method.
-
def
interruptAs(fiberId: ⇒ FiberId)(implicit trace: ZTraceElement): UIO[Nothing]
Returns an effect that is interrupted as if by the specified fiber.
-
def
interruptible[R, E, A](zio: ⇒ ZIO[R, E, A])(implicit trace: ZTraceElement): ZIO[R, E, A]
Prefix form of
ZIO#interruptible
. -
def
interruptibleMask[R, E, A](k: (InterruptStatusRestore) ⇒ ZIO[R, E, A])(implicit trace: ZTraceElement): ZIO[R, E, A]
Makes the effect interruptible, but passes it a restore function that can be used to restore the inherited interruptibility from whatever region the effect is composed into.
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
iterate[R, E, S](initial: ⇒ S)(cont: (S) ⇒ Boolean)(body: (S) ⇒ ZIO[R, E, S])(implicit trace: ZTraceElement): ZIO[R, E, S]
Iterates with the specified effectual function.
Iterates with the specified effectual function. The moral equivalent of:
var s = initial while (cont(s)) { s = body(s) } s
-
def
left[A](a: ⇒ A)(implicit trace: ZTraceElement): UIO[Either[A, Nothing]]
Returns an effect with the value on the left part.
-
def
log(message: ⇒ String)(implicit trace: ZTraceElement): UIO[Unit]
Logs the specified message at the current log level.
-
def
logAnnotate(key: ⇒ String, value: ⇒ String): LogAnnotate
Annotates each log in this effect with the specified log annotation.
-
def
logAnnotations(implicit trace: ZTraceElement): UIO[Map[String, String]]
Retrieves the log annotations associated with the current scope.
-
def
logCause(message: ⇒ String, cause: ⇒ Cause[Any])(implicit trace: ZTraceElement): UIO[Unit]
Logs the specified message and cause at the current log level.
-
def
logCause(cause: ⇒ Cause[Any])(implicit trace: ZTraceElement): UIO[Unit]
Logs the specified cause at the current log level.
-
def
logDebug(message: ⇒ String)(implicit trace: ZTraceElement): UIO[Unit]
Logs the specified message at the debug log level.
-
def
logDebugCause(cause: ⇒ Cause[Any])(implicit trace: ZTraceElement): UIO[Unit]
Logs the specified cause at the debug log level..
-
def
logDebugCause(message: String, cause: ⇒ Cause[Any])(implicit trace: ZTraceElement): UIO[Unit]
Logs the specified cause at the debug log level.
-
def
logError(message: ⇒ String)(implicit trace: ZTraceElement): UIO[Unit]
Logs the specified message at the error log level.
-
def
logErrorCause(cause: ⇒ Cause[Any])(implicit trace: ZTraceElement): UIO[Unit]
Logs the specified cause as an error.
-
def
logErrorCause(message: String, cause: ⇒ Cause[Any])(implicit trace: ZTraceElement): UIO[Unit]
Logs the specified cause as an error.
-
def
logFatal(message: ⇒ String)(implicit trace: ZTraceElement): UIO[Unit]
Logs the specified message at the fatal log level.
-
def
logFatalCause(cause: ⇒ Cause[Any])(implicit trace: ZTraceElement): UIO[Unit]
Logs the specified cause at the fatal log level.
-
def
logFatalCause(message: String, cause: ⇒ Cause[Any])(implicit trace: ZTraceElement): UIO[Unit]
Logs the specified cause at the fatal log level.
-
def
logInfo(message: ⇒ String)(implicit trace: ZTraceElement): UIO[Unit]
Logs the specified message at the informational log level.
-
def
logInfoCause(cause: ⇒ Cause[Any])(implicit trace: ZTraceElement): UIO[Unit]
Logs the specified cause at the informational log level..
-
def
logInfoCause(message: String, cause: ⇒ Cause[Any])(implicit trace: ZTraceElement): UIO[Unit]
Logs the specified cause at the informational log level.
-
def
logLevel(level: LogLevel): LogLevel
Sets the log level for this effect.
Sets the log level for this effect.
ZIO.logLevel(LogLevel.Warning) { ZIO.log("The response time exceeded its threshold!") }
-
def
logSpan(label: ⇒ String): LogSpan
Adjusts the label for the current logging span.
Adjusts the label for the current logging span.
ZIO.logSpan("parsing") { parseRequest(req) }
-
def
logTrace(message: ⇒ String)(implicit trace: ZTraceElement): UIO[Unit]
Logs the specified message at the trace log level.
-
def
logTraceCause(cause: ⇒ Cause[Any])(implicit trace: ZTraceElement): UIO[Unit]
Logs the specified cause at the trace log level..
-
def
logTraceCause(message: String, cause: ⇒ Cause[Any])(implicit trace: ZTraceElement): UIO[Unit]
Logs the specified cause at the trace log level.
-
def
logWarning(message: ⇒ String)(implicit trace: ZTraceElement): UIO[Unit]
Logs the specified message at the warning log level.
-
def
logWarningCause(cause: ⇒ Cause[Any])(implicit trace: ZTraceElement): UIO[Unit]
Logs the specified cause at the warning log level..
-
def
logWarningCause(message: String, cause: ⇒ Cause[Any])(implicit trace: ZTraceElement): UIO[Unit]
Logs the specified cause at the warning log level.
-
def
loop[R, E, A, S](initial: ⇒ S)(cont: (S) ⇒ Boolean, inc: (S) ⇒ S)(body: (S) ⇒ ZIO[R, E, A])(implicit trace: ZTraceElement): ZIO[R, E, List[A]]
Loops with the specified effectual function, collecting the results into a list.
Loops with the specified effectual function, collecting the results into a list. The moral equivalent of:
var s = initial var as = List.empty[A] while (cont(s)) { as = body(s) :: as s = inc(s) } as.reverse
-
def
loopDiscard[R, E, S](initial: ⇒ S)(cont: (S) ⇒ Boolean, inc: (S) ⇒ S)(body: (S) ⇒ ZIO[R, E, Any])(implicit trace: ZTraceElement): ZIO[R, E, Unit]
Loops with the specified effectual function purely for its effects.
Loops with the specified effectual function purely for its effects. The moral equivalent of:
var s = initial while (cont(s)) { body(s) s = inc(s) }
-
def
memoize[R, E, A, B](f: (A) ⇒ ZIO[R, E, B])(implicit trace: ZTraceElement): UIO[(A) ⇒ ZIO[R, E, B]]
Returns a memoized version of the specified effectual function.
-
def
mergeAll[R, E, A, B](in: ⇒ Iterable[ZIO[R, E, A]])(zero: ⇒ B)(f: (B, A) ⇒ B)(implicit trace: ZTraceElement): ZIO[R, E, B]
Merges an
Iterable[IO]
to a single IO, working sequentially. -
def
mergeAllPar[R, E, A, B](in: ⇒ Iterable[ZIO[R, E, A]])(zero: ⇒ B)(f: (B, A) ⇒ B)(implicit trace: ZTraceElement): ZIO[R, E, B]
Merges an
Iterable[IO]
to a single IO, working in parallel.Merges an
Iterable[IO]
to a single IO, working in parallel.Due to the parallel nature of this combinator,
f
must be both:- commutative:
f(a, b) == f(b, a)
- associative:
f(a, f(b, c)) == f(f(a, b), c)
It's unsafe to execute side effects inside
f
, asf
may be executed more than once for some ofin
elements during effect execution. - commutative:
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
never(implicit trace: ZTraceElement): UIO[Nothing]
Returns a effect that will never produce anything.
Returns a effect that will never produce anything. The moral equivalent of
while(true) {}
, only without the wasted CPU cycles. Fibers that suspended running this effect are automatically garbage collected on the JVM, because they cannot be reactivated. -
lazy val
none: UIO[Option[Nothing]]
Returns an effect with the empty value.
-
def
noneOrFail[E](o: ⇒ Option[E])(implicit trace: ZTraceElement): IO[E, Unit]
Lifts an Option into a IO.
Lifts an Option into a IO. If the option is empty it succeeds with Unit. If the option is defined it fails with the content.
-
def
noneOrFailWith[E, O](o: ⇒ Option[O])(f: (O) ⇒ E)(implicit trace: ZTraceElement): IO[E, Unit]
Lifts an Option into a IO.
Lifts an Option into a IO. If the option is empty it succeeds with Unit. If the option is defined it fails with an error adapted with f.
-
def
not[R, E](effect: ⇒ ZIO[R, E, Boolean])(implicit trace: ZTraceElement): ZIO[R, E, Boolean]
Returns a new effect where boolean value of this effect is negated.
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
onExecutor[R, E, A](executor: ⇒ Executor)(zio: ZIO[R, E, A])(implicit trace: ZTraceElement): ZIO[R, E, A]
Returns an effect that will execute the specified effect fully on the provided executor, before returning to the default executor.
Returns an effect that will execute the specified effect fully on the provided executor, before returning to the default executor. See ZIO!.onExecutor.
- def parallelFinalizers[R, E, A](zio: ⇒ ZIO[R, E, A])(implicit trace: ZTraceElement): ZIO[R with Scope, E, A]
-
def
parallelism(implicit trace: ZTraceElement): UIO[Option[Int]]
Retrieves the maximum number of fibers for parallel operators or
None
if it is unbounded. -
def
parallelismWith[R, E, A](f: (Option[Int]) ⇒ ZIO[R, E, A])(implicit trace: ZTraceElement): ZIO[R, E, A]
Retrieves the current maximum number of fibers for parallel operators and uses it to run the specified effect.
-
def
partition[R, E, A, B](in: ⇒ Iterable[A])(f: (A) ⇒ ZIO[R, E, B])(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R, Nothing, (Iterable[E], Iterable[B])]
Feeds elements of type
A
to a functionf
that returns an effect.Feeds elements of type
A
to a functionf
that returns an effect. Collects all successes and failures in a tupled fashion. -
def
partitionPar[R, E, A, B](in: ⇒ Iterable[A])(f: (A) ⇒ ZIO[R, E, B])(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R, Nothing, (Iterable[E], Iterable[B])]
Feeds elements of type
A
to a functionf
that returns an effect.Feeds elements of type
A
to a functionf
that returns an effect. Collects all successes and failures in parallel and returns the result as a tuple. -
def
provideEnvironment[R, E, A](r: ⇒ ZEnvironment[R])(implicit trace: ZTraceElement): (ZIO[R, E, A]) ⇒ IO[E, A]
Given an environment
R
, returns a function that can supply the environment to programs that require it, removing their need for any specific environment.Given an environment
R
, returns a function that can supply the environment to programs that require it, removing their need for any specific environment.This is similar to dependency injection, and the
provide
function can be thought of asinject
. - def provideLayer[RIn, E, ROut, RIn2, ROut2](layer: ZLayer[RIn, E, ROut])(zio: ZIO[ROut with RIn2, E, ROut2])(implicit ev: zio.EnvironmentTag[RIn2], tag: zio.EnvironmentTag[ROut], trace: ZTraceElement): ZIO[RIn with RIn2, E, ROut2]
-
def
raceAll[R, R1 <: R, E, A](zio: ⇒ ZIO[R, E, A], ios: ⇒ Iterable[ZIO[R1, E, A]])(implicit trace: ZTraceElement): ZIO[R1, E, A]
Races an
IO[E, A]
against zero or more other effects.Races an
IO[E, A]
against zero or more other effects. Yields either the first success or the last failure. -
def
reduceAll[R, R1 <: R, E, A](a: ⇒ ZIO[R, E, A], as: ⇒ Iterable[ZIO[R1, E, A]])(f: (A, A) ⇒ A)(implicit trace: ZTraceElement): ZIO[R1, E, A]
Reduces an
Iterable[IO]
to a singleIO
, working sequentially. -
def
reduceAllPar[R, R1 <: R, E, A](a0: ⇒ ZIO[R, E, A], as0: ⇒ Iterable[ZIO[R1, E, A]])(f: (A, A) ⇒ A)(implicit trace: ZTraceElement): ZIO[R1, E, A]
Reduces an
Iterable[IO]
to a singleIO
, working in parallel. -
def
replicate[R, E, A](n: Int)(effect: ZIO[R, E, A])(implicit trace: ZTraceElement): Iterable[ZIO[R, E, A]]
Replicates the given effect
n
times.Replicates the given effect
n
times. If 0 or negative numbers are given, an emptyIterable
will be returned. This method is more efficient than usingList.fill
or similar methods, because the returnedIterable
consumes only a small amount of heap regardless ofn
. -
def
replicateZIO[R, E, A](n: ⇒ Int)(effect: ⇒ ZIO[R, E, A])(implicit trace: ZTraceElement): ZIO[R, E, Iterable[A]]
Performs this effect the specified number of times and collects the results.
-
def
replicateZIODiscard[R, E, A](n: ⇒ Int)(effect: ⇒ ZIO[R, E, A])(implicit trace: ZTraceElement): ZIO[R, E, Unit]
Performs this effect the specified number of times, discarding the results.
-
def
right[B](b: ⇒ B)(implicit trace: ZTraceElement): UIO[Either[Nothing, B]]
Returns an effect with the value on the right part.
-
def
runtime[R](implicit trace: ZTraceElement): URIO[R, Runtime[R]]
Returns an effect that accesses the runtime, which can be used to (unsafely) execute tasks.
Returns an effect that accesses the runtime, which can be used to (unsafely) execute tasks. This is useful for integration with legacy code that must call back into ZIO code.
-
def
runtimeConfig(implicit trace: ZTraceElement): UIO[RuntimeConfig]
Retrieves the runtimeConfig that this effect is running on.
-
def
scope(implicit trace: ZTraceElement): ZIO[Scope, Nothing, Scope]
Returns the current scope.
-
def
scopeWith[R, E, A](f: (Scope) ⇒ ZIO[R, E, A])(implicit trace: ZTraceElement): ZIO[R with Scope, E, A]
Accesses the current scope and uses it to perform the specified effect.
-
def
scoped[R]: ScopedPartiallyApplied[R]
Scopes all resources uses in this effect to the lifetime of the effect, ensuring that their finalizers are run as soon as this effect completes execution, whether by success, failure, or interruption.
Scopes all resources uses in this effect to the lifetime of the effect, ensuring that their finalizers are run as soon as this effect completes execution, whether by success, failure, or interruption.
ZIO.scoped { openFile(name).flatMap(useFile) }
-
def
service[A](implicit arg0: Tag[A], trace: ZTraceElement): URIO[A, A]
Accesses the specified service in the environment of the effect.
-
def
serviceAt[Service]: ServiceAtPartiallyApplied[Service]
Accesses the service corresponding to the specified key in the environment.
-
def
serviceWith[Service]: ServiceWithPartiallyApplied[Service]
Accesses the specified service in the environment of the effect.
Accesses the specified service in the environment of the effect.
Especially useful for creating "accessor" methods on Services' companion objects.
def foo(int: Int) = ZIO.serviceWith[Foo](_.foo(int))
-
def
serviceWithZIO[Service]: ServiceWithZIOPartiallyApplied[Service]
Effectfully accesses the specified service in the environment of the effect.
Effectfully accesses the specified service in the environment of the effect.
Especially useful for creating "accessor" methods on Services' companion objects.
def foo(int: Int) = ZIO.serviceWithZIO[Foo](_.foo(int))
-
def
setFiberRefs(fiberRefs: ⇒ FiberRefs)(implicit trace: ZTraceElement): UIO[Unit]
Sets the
FiberRef
values for the fiber running this effect to the values in the specified collection ofFiberRef
values. -
def
setRuntimeConfig(runtimeConfig: ⇒ RuntimeConfig)(implicit trace: ZTraceElement): UIO[Unit]
Sets the runtime configuration to the specified value.
-
def
setState[S](s: ⇒ S)(implicit arg0: zio.EnvironmentTag[S], trace: ZTraceElement): ZIO[ZState[S], Nothing, Unit]
Sets a state in the environment to the specified value.
-
def
shift(executor: ⇒ Executor)(implicit trace: ZTraceElement): UIO[Unit]
Returns an effect that shifts execution to the specified executor.
Returns an effect that shifts execution to the specified executor. This is useful to specify a default executor that effects sequenced after this one will be run on if they are not shifted somewhere else. It can also be used to implement higher level operators to manage where an effect is run such as ZIO!.onExecutor and ZIO!.onExecutionContext.
-
def
sleep(duration: ⇒ zio.Duration)(implicit trace: ZTraceElement): URIO[Clock, Unit]
Returns an effect that suspends for the specified duration.
Returns an effect that suspends for the specified duration. This method is asynchronous, and does not actually block the fiber executing the effect.
-
def
some[A](a: ⇒ A)(implicit trace: ZTraceElement): UIO[Option[A]]
Returns an effect with the optional value.
-
def
succeed[A](a: ⇒ A)(implicit trace: ZTraceElement): ZIO[Any, Nothing, A]
Returns an effect that models success with the specified value.
-
def
succeedBlocking[A](a: ⇒ A)(implicit trace: ZTraceElement): UIO[A]
Returns a synchronous effect that does blocking and succeeds with the specified value.
-
def
succeedWith[A](f: (RuntimeConfig, FiberId) ⇒ A)(implicit trace: ZTraceElement): UIO[A]
The same as ZIO.succeed, but also provides access to the underlying RuntimeConfig and fiber id.
-
def
suspend[R, A](rio: ⇒ RIO[R, A])(implicit trace: ZTraceElement): RIO[R, A]
Returns a lazily constructed effect, whose construction may itself require effects.
Returns a lazily constructed effect, whose construction may itself require effects. When no environment is required (i.e., when R == Any) it is conceptually equivalent to
flatten(effect(io))
. -
def
suspendSucceed[R, E, A](zio: ⇒ ZIO[R, E, A])(implicit trace: ZTraceElement): ZIO[R, E, A]
Returns a lazily constructed effect, whose construction may itself require effects.
Returns a lazily constructed effect, whose construction may itself require effects. The effect must not throw any exceptions. When no environment is required (i.e., when R == Any) it is conceptually equivalent to
flatten(succeed(zio))
. If you wonder if the effect throws exceptions, do not use this method, use Task.suspend or ZIO.suspend. -
def
suspendSucceedWith[R, E, A](f: (RuntimeConfig, FiberId) ⇒ ZIO[R, E, A])(implicit trace: ZTraceElement): ZIO[R, E, A]
Returns a lazily constructed effect, whose construction may itself require effects.
Returns a lazily constructed effect, whose construction may itself require effects. The effect must not throw any exceptions. When no environment is required (i.e., when R == Any) it is conceptually equivalent to
flatten(succeed(zio))
. If you wonder if the effect throws exceptions, do not use this method, use Task.suspend or ZIO.suspend. -
def
suspendWith[R, A](f: (RuntimeConfig, FiberId) ⇒ RIO[R, A])(implicit trace: ZTraceElement): RIO[R, A]
Returns a lazily constructed effect, whose construction may itself require effects.
Returns a lazily constructed effect, whose construction may itself require effects. When no environment is required (i.e., when R == Any) it is conceptually equivalent to
flatten(effect(io))
. -
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
trace(implicit trace: ZTraceElement): UIO[ZTrace]
Capture ZIO trace at the current point
-
def
transplant[R, E, A](f: (Grafter) ⇒ ZIO[R, E, A])(implicit trace: ZTraceElement): ZIO[R, E, A]
Transplants specified effects so that when those effects fork other effects, the forked effects will be governed by the scope of the fiber that executes this effect.
Transplants specified effects so that when those effects fork other effects, the forked effects will be governed by the scope of the fiber that executes this effect.
This can be used to "graft" deep grandchildren onto a higher-level scope, effectively extending their lifespans into the parent scope.
-
def
uninterruptible[R, E, A](zio: ⇒ ZIO[R, E, A])(implicit trace: ZTraceElement): ZIO[R, E, A]
Prefix form of
ZIO#uninterruptible
. -
def
uninterruptibleMask[R, E, A](k: (InterruptStatusRestore) ⇒ ZIO[R, E, A])(implicit trace: ZTraceElement): ZIO[R, E, A]
Makes the effect uninterruptible, but passes it a restore function that can be used to restore the inherited interruptibility from whatever region the effect is composed into.
-
lazy val
unit: UIO[Unit]
An effect that succeeds with a unit value.
-
def
unless[R, E, A](p: ⇒ Boolean)(zio: ⇒ ZIO[R, E, A])(implicit trace: ZTraceElement): ZIO[R, E, Option[A]]
The moral equivalent of
if (!p) exp
-
def
unlessZIO[R, E](p: ⇒ ZIO[R, E, Boolean]): UnlessZIO[R, E]
The moral equivalent of
if (!p) exp
whenp
has side-effects -
def
unsandbox[R, E, A](v: ⇒ ZIO[R, Cause[E], A])(implicit trace: ZTraceElement): ZIO[R, E, A]
The inverse operation
IO.sandboxed
The inverse operation
IO.sandboxed
Terminates with exceptions on the
Left
side of theEither
error, if it exists. Otherwise extracts the containedIO[E, A]
-
def
unshift(implicit trace: ZTraceElement): UIO[Unit]
Returns an effect indicating that execution is no longer required to be performed on the current executor.
Returns an effect indicating that execution is no longer required to be performed on the current executor. The runtime may continue executing on this executor for efficiency but will not automatically shift back to it after completing an effect on another executor.
-
def
updateState[S](f: (S) ⇒ S)(implicit arg0: zio.EnvironmentTag[S], trace: ZTraceElement): ZIO[ZState[S], Nothing, Unit]
Updates a state in the environment with the specified function.
-
def
validate[R, E, A, B](in: NonEmptyChunk[A])(f: (A) ⇒ ZIO[R, E, B])(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R, ::[E], NonEmptyChunk[B]]
Feeds elements of type
A
tof
and accumulates all errors in error channel or successes in success channel.Feeds elements of type
A
tof
and accumulates all errors in error channel or successes in success channel.This combinator is lossy meaning that if there are errors all successes will be lost. To retain all information please use partition.
-
def
validate[R, E, A, B, Collection[+Element] <: Iterable[Element]](in: Collection[A])(f: (A) ⇒ ZIO[R, E, B])(implicit bf: zio.BuildFrom[Collection[A], B, Collection[B]], ev: CanFail[E], trace: ZTraceElement): ZIO[R, ::[E], Collection[B]]
Feeds elements of type
A
tof
and accumulates all errors in error channel or successes in success channel.Feeds elements of type
A
tof
and accumulates all errors in error channel or successes in success channel.This combinator is lossy meaning that if there are errors all successes will be lost. To retain all information please use partition.
-
def
validateDiscard[R, E, A](in: ⇒ Iterable[A])(f: (A) ⇒ ZIO[R, E, Any])(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R, ::[E], Unit]
Feeds elements of type
A
tof
and accumulates all errors, discarding the successes. -
def
validateFirst[R, E, A, B, Collection[+Element] <: Iterable[Element]](in: Collection[A])(f: (A) ⇒ ZIO[R, E, B])(implicit bf: zio.BuildFrom[Collection[A], E, Collection[E]], ev: CanFail[E], trace: ZTraceElement): ZIO[R, Collection[E], B]
Feeds elements of type
A
tof
until it succeeds.Feeds elements of type
A
tof
until it succeeds. Returns first success or the accumulation of all errors. -
def
validateFirstPar[R, E, A, B, Collection[+Element] <: Iterable[Element]](in: Collection[A])(f: (A) ⇒ ZIO[R, E, B])(implicit bf: zio.BuildFrom[Collection[A], E, Collection[E]], ev: CanFail[E], trace: ZTraceElement): ZIO[R, Collection[E], B]
Feeds elements of type
A
tof
, in parallel, until it succeeds.Feeds elements of type
A
tof
, in parallel, until it succeeds. Returns first success or the accumulation of all errors.In case of success all other running fibers are terminated.
-
def
validatePar[R, E, A, B](in: NonEmptyChunk[A])(f: (A) ⇒ ZIO[R, E, B])(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R, ::[E], NonEmptyChunk[B]]
Feeds elements of type
A
tof
and accumulates, in parallel, all errors in error channel or successes in success channel.Feeds elements of type
A
tof
and accumulates, in parallel, all errors in error channel or successes in success channel.This combinator is lossy meaning that if there are errors all successes will be lost. To retain all information please use partitionPar.
-
def
validatePar[R, E, A, B, Collection[+Element] <: Iterable[Element]](in: Collection[A])(f: (A) ⇒ ZIO[R, E, B])(implicit bf: zio.BuildFrom[Collection[A], B, Collection[B]], ev: CanFail[E], trace: ZTraceElement): ZIO[R, ::[E], Collection[B]]
Feeds elements of type
A
tof
and accumulates, in parallel, all errors in error channel or successes in success channel.Feeds elements of type
A
tof
and accumulates, in parallel, all errors in error channel or successes in success channel.This combinator is lossy meaning that if there are errors all successes will be lost. To retain all information please use partitionPar.
-
def
validateParDiscard[R, E, A](in: ⇒ Iterable[A])(f: (A) ⇒ ZIO[R, E, Any])(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R, ::[E], Unit]
Feeds elements of type
A
tof
in parallel and accumulates all errors, discarding the successes. -
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
- @throws( ... ) @native()
-
def
when[R, E, A](p: ⇒ Boolean)(zio: ⇒ ZIO[R, E, A])(implicit trace: ZTraceElement): ZIO[R, E, Option[A]]
The moral equivalent of
if (p) exp
-
def
whenCase[R, E, A, B](a: ⇒ A)(pf: PartialFunction[A, ZIO[R, E, B]])(implicit trace: ZTraceElement): ZIO[R, E, Option[B]]
Runs an effect when the supplied
PartialFunction
matches for the given value, otherwise does nothing. -
def
whenCaseZIO[R, E, A, B](a: ⇒ ZIO[R, E, A])(pf: PartialFunction[A, ZIO[R, E, B]])(implicit trace: ZTraceElement): ZIO[R, E, Option[B]]
Runs an effect when the supplied
PartialFunction
matches for the given effectful value, otherwise does nothing. -
def
whenZIO[R, E](p: ⇒ ZIO[R, E, Boolean]): WhenZIO[R, E]
The moral equivalent of
if (p) exp
whenp
has side-effects -
def
withChildren[R, E, A](get: (UIO[Chunk[Fiber.Runtime[Any, Any]]]) ⇒ ZIO[R, E, A])(implicit trace: ZTraceElement): ZIO[R, E, A]
Locally installs a supervisor and an effect that succeeds with all the children that have been forked in the returned effect.
-
def
withParallelism[R, E, A](n: ⇒ Int)(zio: ZIO[R, E, A])(implicit trace: ZTraceElement): ZIO[R, E, A]
Runs the specified effect with the specified maximum number of fibers for parallel operators.
-
def
withParallelismUnbounded[R, E, A](zio: ZIO[R, E, A])(implicit trace: ZTraceElement): ZIO[R, E, A]
Runs the specified effect with an unbounded maximum number of fibers for parallel operators.
-
def
withRuntimeConfig[R, E, A](runtimeConfig: ⇒ RuntimeConfig)(zio: ⇒ ZIO[R, E, A])(implicit trace: ZTraceElement): ZIO[R, E, A]
Runs the specified effect on the specified runtime configuration, restoring the old runtime configuration when it completes execution.
-
def
yieldNow(implicit trace: ZTraceElement): UIO[Unit]
Returns an effect that yields to the runtime system, starting on a fresh stack.
Returns an effect that yields to the runtime system, starting on a fresh stack. Manual use of this method can improve fairness, at the cost of overhead.
- object CanFilter
- object InterruptStatusRestore
- object ZIOConstructor extends ZIOConstructorLowPriority1
Deprecated Value Members
-
def
access[R]: EnvironmentWithPartiallyApplied[R]
Accesses the environment of the effect.
Accesses the environment of the effect.
val portNumber = effect.access(_.config.portNumber)
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use environmentWith
-
def
accessM[R]: EnvironmentWithZIOPartiallyApplied[R]
Effectfully accesses the environment of the effect.
Effectfully accesses the environment of the effect.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use environmentWithZIO
-
def
accessZIO[R]: EnvironmentWithZIOPartiallyApplied[R]
Effectfully accesses the environment of the effect.
Effectfully accesses the environment of the effect.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use environmentWithZIO
-
def
apply[A](a: ⇒ A)(implicit trace: ZTraceElement): Task[A]
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use attempt or succeed
-
def
bracket[R, E, A, B](acquire: ⇒ ZIO[R, E, A], release: (A) ⇒ URIO[R, Any], use: (A) ⇒ ZIO[R, E, B])(implicit trace: ZTraceElement): ZIO[R, E, B]
Uncurried version.
Uncurried version. Doesn't offer curried syntax and have worse type-inference characteristics, but guarantees no extra allocations of intermediate zio.ZIO.Acquire and zio.ZIO.Release objects.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use acquireReleaseWith
-
def
bracket[R, E, A](acquire: ⇒ ZIO[R, E, A]): Acquire[R, E, A]
When this effect represents acquisition of a resource (for example, opening a file, launching a thread, etc.),
bracket
can be used to ensure the acquisition is not interrupted and the resource is always released.When this effect represents acquisition of a resource (for example, opening a file, launching a thread, etc.),
bracket
can be used to ensure the acquisition is not interrupted and the resource is always released.The function does two things:
- Ensures this effect, which acquires the resource, will not be
interrupted. Of course, acquisition may fail for internal reasons (an
uncaught exception). 2. Ensures the
release
effect will not be interrupted, and will be executed so long as this effect successfully acquires the resource.
In between acquisition and release of the resource, the
use
effect is executed.If the
release
effect fails, then the entire effect will fail even if theuse
effect succeeds. If this fail-fast behavior is not desired, errors produced by therelease
effect can be caught and ignored.openFile("data.json").bracket(closeFile) { file => for { header <- readHeader(file) ... } yield result }
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use acquireReleaseWith
- Ensures this effect, which acquires the resource, will not be
interrupted. Of course, acquisition may fail for internal reasons (an
uncaught exception). 2. Ensures the
-
def
bracketExit[R, E, A, B](acquire: ⇒ ZIO[R, E, A], release: (A, Exit[E, B]) ⇒ URIO[R, Any], use: (A) ⇒ ZIO[R, E, B])(implicit trace: ZTraceElement): ZIO[R, E, B]
Uncurried version.
Uncurried version. Doesn't offer curried syntax and has worse type-inference characteristics, but guarantees no extra allocations of intermediate zio.ZIO.AcquireExit and zio.ZIO.ReleaseExit objects.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use acquireReleaseExitWith
-
def
bracketExit[R, E, A](acquire: ⇒ ZIO[R, E, A]): AcquireExit[R, E, A]
Acquires a resource, uses the resource, and then releases the resource.
Acquires a resource, uses the resource, and then releases the resource. Neither the acquisition nor the release will be interrupted, and the resource is guaranteed to be released, so long as the
acquire
effect succeeds. Ifuse
fails, then after release, the returned effect will fail with the same error.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use acquireReleaseExitWith
-
def
collectAllParN[R, E, A, Collection[+Element] <: Iterable[Element]](n: ⇒ Int)(as: Collection[ZIO[R, E, A]])(implicit bf: zio.BuildFrom[Collection[ZIO[R, E, A]], A, Collection[A]], trace: ZTraceElement): ZIO[R, E, Collection[A]]
Evaluate each effect in the structure in parallel, and collect the results.
Evaluate each effect in the structure in parallel, and collect the results. For a sequential version, see
collectAll
.Unlike
collectAllPar
, this method will use at mostn
fibers.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use collectAllPar
-
def
collectAllParNDiscard[R, E, A](n: ⇒ Int)(as: ⇒ Iterable[ZIO[R, E, A]])(implicit trace: ZTraceElement): ZIO[R, E, Unit]
Evaluate each effect in the structure in parallel, and discard the results.
Evaluate each effect in the structure in parallel, and discard the results. For a sequential version, see
collectAllDiscard
.Unlike
collectAllParDiscard
, this method will use at mostn
fibers.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use collectAllParDiscard
-
def
collectAllParN_[R, E, A](n: ⇒ Int)(as: ⇒ Iterable[ZIO[R, E, A]])(implicit trace: ZTraceElement): ZIO[R, E, Unit]
Evaluate each effect in the structure in parallel, and discard the results.
Evaluate each effect in the structure in parallel, and discard the results. For a sequential version, see
collectAll_
.Unlike
collectAllPar_
, this method will use at mostn
fibers.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use collectAllParDiscard
-
def
collectAllPar_[R, E, A](as: ⇒ Iterable[ZIO[R, E, A]])(implicit trace: ZTraceElement): ZIO[R, E, Unit]
Evaluate each effect in the structure in parallel, and discard the results.
Evaluate each effect in the structure in parallel, and discard the results. For a sequential version, see
collectAll_
.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use collectAllParDiscard
-
def
collectAllSuccessesParN[R, E, A, Collection[+Element] <: Iterable[Element]](n: ⇒ Int)(in: Collection[ZIO[R, E, A]])(implicit bf: zio.BuildFrom[Collection[ZIO[R, E, A]], A, Collection[A]], trace: ZTraceElement): URIO[R, Collection[A]]
Evaluate and run each effect in the structure in parallel, and collect discarding failed ones.
Evaluate and run each effect in the structure in parallel, and collect discarding failed ones.
Unlike
collectAllSuccessesPar
, this method will use at most up ton
fibers.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use collectAllSuccessesPar
-
def
collectAllWithParN[R, E, A, B, Collection[+Element] <: Iterable[Element]](n: ⇒ Int)(in: Collection[ZIO[R, E, A]])(f: PartialFunction[A, B])(implicit bf: zio.BuildFrom[Collection[ZIO[R, E, A]], B, Collection[B]], trace: ZTraceElement): ZIO[R, E, Collection[B]]
Evaluate each effect in the structure with
collectAllPar
, and collect the results with given partial function.Evaluate each effect in the structure with
collectAllPar
, and collect the results with given partial function.Unlike
collectAllWithPar
, this method will use at most up ton
fibers.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use collectAllWithPar
-
def
collectAll_[R, E, A](in: ⇒ Iterable[ZIO[R, E, A]])(implicit trace: ZTraceElement): ZIO[R, E, Unit]
Evaluate each effect in the structure from left to right, and discard the results.
Evaluate each effect in the structure from left to right, and discard the results. For a parallel version, see
collectAllPar_
.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use collectAllDiscard
-
def
collectParN[R, E, A, B, Collection[+Element] <: Iterable[Element]](n: ⇒ Int)(in: Collection[A])(f: (A) ⇒ ZIO[R, Option[E], B])(implicit bf: zio.BuildFrom[Collection[A], B, Collection[B]], trace: ZTraceElement): ZIO[R, E, Collection[B]]
Evaluate each effect in the structure in parallel, collecting the the successful values and discarding the empty cases.
Evaluate each effect in the structure in parallel, collecting the the successful values and discarding the empty cases.
Unlike
collectPar
, this method will use at most up ton
fibers.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use collectPar
-
def
effect[A](effect: ⇒ A)(implicit trace: ZTraceElement): Task[A]
Imports a synchronous side-effect into a pure
ZIO
value, translating any thrown exceptions into typed failed effects creating withZIO.fail
.Imports a synchronous side-effect into a pure
ZIO
value, translating any thrown exceptions into typed failed effects creating withZIO.fail
.def printLine(line: String): Task[Unit] = Task.effect(println(line))
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use attempt
-
def
effectAsync[R, E, A](register: ((ZIO[R, E, A]) ⇒ Unit) ⇒ Any, blockingOn: ⇒ FiberId = null)(implicit trace: ZTraceElement): ZIO[R, E, A]
Imports an asynchronous side-effect into a pure
ZIO
value.Imports an asynchronous side-effect into a pure
ZIO
value. SeeeffectAsyncMaybe
for the more expressive variant of this function that can return a value synchronously.The callback function
ZIO[R, E, A] => Any
must be called at most once.The list of fibers, that may complete the async callback, is used to provide better diagnostics.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use async
-
def
effectAsyncInterrupt[R, E, A](register: ((ZIO[R, E, A]) ⇒ Unit) ⇒ Either[Canceler[R], ZIO[R, E, A]], blockingOn: ⇒ FiberId = FiberId.None)(implicit trace: ZTraceElement): ZIO[R, E, A]
Imports an asynchronous side-effect into a ZIO effect.
Imports an asynchronous side-effect into a ZIO effect. The side-effect has the option of returning the value synchronously, which is useful in cases where it cannot be determined if the effect is synchronous or asynchronous until the side-effect is actually executed. The effect also has the option of returning a canceler, which will be used by the runtime to cancel the asynchronous effect if the fiber executing the effect is interrupted.
If the register function returns a value synchronously, then the callback function
ZIO[R, E, A] => Any
must not be called. Otherwise the callback function must be called at most once.The list of fibers, that may complete the async callback, is used to provide better diagnostics.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use asyncInterrupt
-
def
effectAsyncM[R, E, A](register: ((ZIO[R, E, A]) ⇒ Unit) ⇒ ZIO[R, E, Any])(implicit trace: ZTraceElement): ZIO[R, E, A]
Imports an asynchronous effect into a pure
ZIO
value.Imports an asynchronous effect into a pure
ZIO
value. This formulation is necessary when the effect is itself expressed in terms ofZIO
.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use asyncZIO
-
def
effectAsyncMaybe[R, E, A](register: ((ZIO[R, E, A]) ⇒ Unit) ⇒ Option[ZIO[R, E, A]], blockingOn: ⇒ FiberId = FiberId.None)(implicit trace: ZTraceElement): ZIO[R, E, A]
Imports an asynchronous effect into a pure
ZIO
value, possibly returning the value synchronously.Imports an asynchronous effect into a pure
ZIO
value, possibly returning the value synchronously.If the register function returns a value synchronously, then the callback function
ZIO[R, E, A] => Any
must not be called. Otherwise the callback function must be called at most once.The list of fibers, that may complete the async callback, is used to provide better diagnostics.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use asyncMaybe
-
def
effectBlocking[A](effect: ⇒ A)(implicit trace: ZTraceElement): Task[A]
Imports a synchronous effect that does blocking IO into a pure value.
Imports a synchronous effect that does blocking IO into a pure value.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use attemptBlocking
-
def
effectBlockingCancelable[R, A](effect: ⇒ A)(cancel: ⇒ URIO[R, Any])(implicit trace: ZTraceElement): RIO[R, A]
Imports a synchronous effect that does blocking IO into a pure value, with a custom cancel effect.
Imports a synchronous effect that does blocking IO into a pure value, with a custom cancel effect.
If the returned
ZIO
is interrupted, the blocked thread running the synchronous effect will be interrupted via the cancel effect.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use attemptBlockingCancelable
-
def
effectBlockingIO[A](effect: ⇒ A)(implicit trace: ZTraceElement): IO[IOException, A]
Imports a synchronous effect that does blocking IO into a pure value, refining the error type to
java.io.IOException
.Imports a synchronous effect that does blocking IO into a pure value, refining the error type to
java.io.IOException
.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use attemptBlockingIO
-
def
effectBlockingInterrupt[A](effect: ⇒ A)(implicit trace: ZTraceElement): Task[A]
Imports a synchronous effect that does blocking IO into a pure value.
Imports a synchronous effect that does blocking IO into a pure value.
If the returned
ZIO
is interrupted, the blocked thread running the synchronous effect will be interrupted viaThread.interrupt
.Note that this adds significant overhead. For performance sensitive applications consider using
effectBlocking
oreffectBlockingCancel
.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use attemptBlockingInterrupt
-
def
effectSuspend[R, A](rio: ⇒ RIO[R, A])(implicit trace: ZTraceElement): RIO[R, A]
Returns a lazily constructed effect, whose construction may itself require effects.
Returns a lazily constructed effect, whose construction may itself require effects. When no environment is required (i.e., when R == Any) it is conceptually equivalent to
flatten(effect(io))
.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use suspend
-
def
effectSuspendTotal[R, E, A](zio: ⇒ ZIO[R, E, A])(implicit trace: ZTraceElement): ZIO[R, E, A]
Returns a lazily constructed effect, whose construction may itself require effects.
Returns a lazily constructed effect, whose construction may itself require effects. The effect must not throw any exceptions. When no environment is required (i.e., when R == Any) it is conceptually equivalent to
flatten(effectTotal(zio))
. If you wonder if the effect throws exceptions, do not use this method, use Task.effectSuspend or ZIO.effectSuspend.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use suspendSucceed
-
def
effectSuspendTotalWith[R, E, A](f: (Platform, Id) ⇒ ZIO[R, E, A])(implicit trace: ZTraceElement): ZIO[R, E, A]
Returns a lazily constructed effect, whose construction may itself require effects.
Returns a lazily constructed effect, whose construction may itself require effects. The effect must not throw any exceptions. When no environment is required (i.e., when R == Any) it is conceptually equivalent to
flatten(effectTotal(zio))
. If you wonder if the effect throws exceptions, do not use this method, use Task.effectSuspend or ZIO.effectSuspend.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use suspendSucceedWith
-
def
effectSuspendWith[R, A](f: (Platform, Id) ⇒ RIO[R, A])(implicit trace: ZTraceElement): RIO[R, A]
Returns a lazily constructed effect, whose construction may itself require effects.
Returns a lazily constructed effect, whose construction may itself require effects. When no environment is required (i.e., when R == Any) it is conceptually equivalent to
flatten(effect(io))
.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use suspendWith
-
def
effectTotal[A](effect: ⇒ A)(implicit trace: ZTraceElement): UIO[A]
Captures a synchronous computation into a lazy effect, which can be executed later and repeatedly.
Captures a synchronous computation into a lazy effect, which can be executed later and repeatedly. The synchronous computation must not throw any exceptions. If you are unsure, then don't use this method, use Task.effect, IO.effect, or ZIO.effect.
val nanoTime: UIO[Long] = IO.succeed(System.nanoTime())
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use succeed
-
def
effectTotalWith[A](effect: (Platform, Id) ⇒ A)(implicit trace: ZTraceElement): UIO[A]
The same as ZIO.effectTotal, but also provides access to the underlying RuntimeConfig and fiber id.
The same as ZIO.effectTotal, but also provides access to the underlying RuntimeConfig and fiber id.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use succeedWith
-
def
foreachParN[R, E, A, B, Collection[+Element] <: Iterable[Element]](n: ⇒ Int)(as: Collection[A])(fn: (A) ⇒ ZIO[R, E, B])(implicit bf: zio.BuildFrom[Collection[A], B, Collection[B]], trace: ZTraceElement): ZIO[R, E, Collection[B]]
Applies the function
f
to each element of theCollection[A]
in parallel, and returns the results in a newCollection[B]
.Applies the function
f
to each element of theCollection[A]
in parallel, and returns the results in a newCollection[B]
.Unlike
foreachPar
, this method will use at most up ton
fibers.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use foreachPar
-
def
foreachParNDiscard[R, E, A](n: ⇒ Int)(as: ⇒ Iterable[A])(f: (A) ⇒ ZIO[R, E, Any])(implicit trace: ZTraceElement): ZIO[R, E, Unit]
Applies the function
f
to each element of theIterable[A]
and runs produced effects in parallel, discarding the results.Applies the function
f
to each element of theIterable[A]
and runs produced effects in parallel, discarding the results.Unlike
foreachParDiscard
, this method will use at most up ton
fibers.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use foreachParDiscard
-
def
foreachParN_[R, E, A](n: ⇒ Int)(as: ⇒ Iterable[A])(f: (A) ⇒ ZIO[R, E, Any])(implicit trace: ZTraceElement): ZIO[R, E, Unit]
Applies the function
f
to each element of theIterable[A]
and runs produced effects in parallel, discarding the results.Applies the function
f
to each element of theIterable[A]
and runs produced effects in parallel, discarding the results.Unlike
foreachPar_
, this method will use at most up ton
fibers.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use foreachParDiscard
-
def
foreachPar_[R, E, A](as: ⇒ Iterable[A])(f: (A) ⇒ ZIO[R, E, Any])(implicit trace: ZTraceElement): ZIO[R, E, Unit]
Applies the function
f
to each element of theIterable[A]
and runs produced effects in parallel, discarding the results.Applies the function
f
to each element of theIterable[A]
and runs produced effects in parallel, discarding the results.For a sequential version of this method, see
foreach_
.Optimized to avoid keeping full tree of effects, so that method could be able to handle large input sequences. Behaves almost like this code:
as.foldLeft(ZIO.unit) { (acc, a) => acc.zipParLeft(f(a)) }
Additionally, interrupts all effects on any failure.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use foreachParDiscard
-
def
foreach_[R, E, A](as: ⇒ Iterable[A])(f: (A) ⇒ ZIO[R, E, Any])(implicit trace: ZTraceElement): ZIO[R, E, Unit]
Applies the function
f
to each element of theIterable[A]
and runs produced effects sequentially.Applies the function
f
to each element of theIterable[A]
and runs produced effects sequentially.Equivalent to
foreach(as)(f).unit
, but without the cost of building the list of results.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use foreachDiscard
-
def
forkAll_[R, E, A](as: ⇒ Iterable[ZIO[R, E, A]])(implicit trace: ZTraceElement): URIO[R, Unit]
Returns an effect that forks all of the specified values, and returns a composite fiber that produces unit.
Returns an effect that forks all of the specified values, and returns a composite fiber that produces unit. This version is faster than forkAll in cases where the results of the forked fibers are not needed.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use forkAllDiscard
-
def
fromFiberM[E, A](fiber: IO[E, Fiber[E, A]])(implicit trace: ZTraceElement): IO[E, A]
Creates a
ZIO
value that represents the exit value of the specified fiber.Creates a
ZIO
value that represents the exit value of the specified fiber.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use fromFiberZIO
-
def
fromFunction[R, A](f: (ZEnvironment[R]) ⇒ A)(implicit trace: ZTraceElement): URIO[R, A]
Lifts a function
R => A
into aURIO[R, A]
.Lifts a function
R => A
into aURIO[R, A]
.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use access
-
def
fromFunctionM[R, E, A](f: (ZEnvironment[R]) ⇒ IO[E, A])(implicit trace: ZTraceElement): ZIO[R, E, A]
Lifts an effectful function whose effect requires no environment into an effect that requires the input to the function.
Lifts an effectful function whose effect requires no environment into an effect that requires the input to the function.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use environmentWithZIO
-
def
halt[E](cause: ⇒ Cause[E])(implicit trace: ZTraceElement): IO[E, Nothing]
Returns an effect that models failure with the specified
Cause
.Returns an effect that models failure with the specified
Cause
.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use failCause
-
def
ifM[R, E](b: ⇒ ZIO[R, E, Boolean]): IfZIO[R, E]
Runs
onTrue
if the result ofb
istrue
andonFalse
otherwise.Runs
onTrue
if the result ofb
istrue
andonFalse
otherwise.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use ifZIO
-
def
lock[R, E, A](executor: ⇒ Executor)(zio: ⇒ ZIO[R, E, A])(implicit trace: ZTraceElement): ZIO[R, E, A]
Returns an effect that will execute the specified effect fully on the provided executor, before returning to the default executor.
Returns an effect that will execute the specified effect fully on the provided executor, before returning to the default executor. See ZIO!.lock.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use onExecutor
-
def
loop_[R, E, S](initial: ⇒ S)(cont: (S) ⇒ Boolean, inc: (S) ⇒ S)(body: (S) ⇒ ZIO[R, E, Any])(implicit trace: ZTraceElement): ZIO[R, E, Unit]
Loops with the specified effectual function purely for its effects.
Loops with the specified effectual function purely for its effects. The moral equivalent of:
var s = initial while (cont(s)) { body(s) s = inc(s) }
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use loopDiscard
-
def
mapN[R, E, A, B, C, D, F](zio1: ⇒ ZIO[R, E, A], zio2: ⇒ ZIO[R, E, B], zio3: ⇒ ZIO[R, E, C], zio4: ⇒ ZIO[R, E, D])(f: (A, B, C, D) ⇒ F)(implicit trace: ZTraceElement): ZIO[R, E, F]
Sequentially zips the specified effects using the specified combiner function.
Sequentially zips the specified effects using the specified combiner function.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use zip
-
def
mapN[R, E, A, B, C, D](zio1: ⇒ ZIO[R, E, A], zio2: ⇒ ZIO[R, E, B], zio3: ⇒ ZIO[R, E, C])(f: (A, B, C) ⇒ D)(implicit trace: ZTraceElement): ZIO[R, E, D]
Sequentially zips the specified effects using the specified combiner function.
Sequentially zips the specified effects using the specified combiner function.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use zip
-
def
mapN[R, E, A, B, C](zio1: ⇒ ZIO[R, E, A], zio2: ⇒ ZIO[R, E, B])(f: (A, B) ⇒ C)(implicit trace: ZTraceElement): ZIO[R, E, C]
Sequentially zips the specified effects using the specified combiner function.
Sequentially zips the specified effects using the specified combiner function.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use zip
-
def
mapParN[R, E, A, B, C, D, F](zio1: ⇒ ZIO[R, E, A], zio2: ⇒ ZIO[R, E, B], zio3: ⇒ ZIO[R, E, C], zio4: ⇒ ZIO[R, E, D])(f: (A, B, C, D) ⇒ F)(implicit trace: ZTraceElement): ZIO[R, E, F]
Returns an effect that executes the specified effects in parallel, combining their results with the specified
f
function.Returns an effect that executes the specified effects in parallel, combining their results with the specified
f
function. If any effect fails, then the other effects will be interrupted.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use zipPar
-
def
mapParN[R, E, A, B, C, D](zio1: ⇒ ZIO[R, E, A], zio2: ⇒ ZIO[R, E, B], zio3: ⇒ ZIO[R, E, C])(f: (A, B, C) ⇒ D)(implicit trace: ZTraceElement): ZIO[R, E, D]
Returns an effect that executes the specified effects in parallel, combining their results with the specified
f
function.Returns an effect that executes the specified effects in parallel, combining their results with the specified
f
function. If any effect fails, then the other effects will be interrupted.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use zipPar
-
def
mapParN[R, E, A, B, C](zio1: ⇒ ZIO[R, E, A], zio2: ⇒ ZIO[R, E, B])(f: (A, B) ⇒ C)(implicit trace: ZTraceElement): ZIO[R, E, C]
Returns an effect that executes the specified effects in parallel, combining their results with the specified
f
function.Returns an effect that executes the specified effects in parallel, combining their results with the specified
f
function. If any effect fails, then the other effects will be interrupted.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use zipPar
-
def
mergeAllParN[R, E, A, B](n: ⇒ Int)(in: ⇒ Iterable[ZIO[R, E, A]])(zero: ⇒ B)(f: (B, A) ⇒ B)(implicit trace: ZTraceElement): ZIO[R, E, B]
Merges an
Iterable[IO]
to a single IO, working in with up ton
fibers in parallel.Merges an
Iterable[IO]
to a single IO, working in with up ton
fibers in parallel.Due to the parallel nature of this combinator,
f
must be both:- commutative:
f(a, b) == f(b, a)
- associative:
f(a, f(b, c)) == f(f(a, b), c)
It's unsafe to execute side effects inside
f
, asf
may be executed more than once for some ofin
elements during effect execution.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use mergeAllPar
- commutative:
-
def
partitionParN[R, E, A, B](n: ⇒ Int)(in: ⇒ Iterable[A])(f: (A) ⇒ ZIO[R, E, B])(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R, Nothing, (Iterable[E], Iterable[B])]
Feeds elements of type
A
to a functionf
that returns an effect.Feeds elements of type
A
to a functionf
that returns an effect. Collects all successes and failures in parallel and returns the result as a tuple.Unlike partitionPar, this method will use at most up to
n
fibers.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use partitionPar
-
def
reduceAllParN[R, R1 <: R, E, A](n: ⇒ Int)(a0: ⇒ ZIO[R, E, A], as0: ⇒ Iterable[ZIO[R1, E, A]])(f: (A, A) ⇒ A)(implicit trace: ZTraceElement): ZIO[R1, E, A]
Reduces an
Iterable[IO]
to a singleIO
, working in up ton
fibers in parallel.Reduces an
Iterable[IO]
to a singleIO
, working in up ton
fibers in parallel.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use reduceAllPar
-
def
replicateM[R, E, A](n: ⇒ Int)(effect: ⇒ ZIO[R, E, A])(implicit trace: ZTraceElement): 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.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use replicateZIO
-
def
replicateM_[R, E, A](n: ⇒ Int)(effect: ⇒ ZIO[R, E, A])(implicit trace: ZTraceElement): 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.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use replicateZIODiscard
-
def
require[R, E, A](error: ⇒ E)(implicit trace: ZTraceElement): (ZIO[R, E, Option[A]]) ⇒ ZIO[R, E, A]
Requires that the given
ZIO[R, E, Option[A]]
contain a value.Requires that the given
ZIO[R, E, Option[A]]
contain a value. If there is no value, then the specified error will be raised.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use someOrFail
-
def
services[A, B, C, D](implicit arg0: Tag[A], arg1: Tag[B], arg2: Tag[C], arg3: Tag[D], trace: ZTraceElement): URIO[A with B with C with D, (A, B, C, D)]
Accesses the specified services in the environment of the effect.
Accesses the specified services in the environment of the effect.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use service
-
def
services[A, B, C](implicit arg0: Tag[A], arg1: Tag[B], arg2: Tag[C], trace: ZTraceElement): URIO[A with B with C, (A, B, C)]
Accesses the specified services in the environment of the effect.
Accesses the specified services in the environment of the effect.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use service
-
def
services[A, B](implicit arg0: Tag[A], arg1: Tag[B], trace: ZTraceElement): URIO[A with B, (A, B)]
Accesses the specified services in the environment of the effect.
Accesses the specified services in the environment of the effect.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use service
-
def
tupled[R, E, A, B, C, D](zio1: ⇒ ZIO[R, E, A], zio2: ⇒ ZIO[R, E, B], zio3: ⇒ ZIO[R, E, C], zio4: ⇒ ZIO[R, E, D])(implicit trace: ZTraceElement): ZIO[R, E, (A, B, C, D)]
Sequentially zips the specified effects.
Sequentially zips the specified effects. Specialized version of mapN.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use zip
-
def
tupled[R, E, A, B, C](zio1: ⇒ ZIO[R, E, A], zio2: ⇒ ZIO[R, E, B], zio3: ⇒ ZIO[R, E, C])(implicit trace: ZTraceElement): ZIO[R, E, (A, B, C)]
Sequentially zips the specified effects.
Sequentially zips the specified effects. Specialized version of mapN.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use zip
-
def
tupled[R, E, A, B](zio1: ⇒ ZIO[R, E, A], zio2: ⇒ ZIO[R, E, B])(implicit trace: ZTraceElement): ZIO[R, E, (A, B)]
Sequentially zips the specified effects.
Sequentially zips the specified effects. Specialized version of mapN.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use zip
-
def
tupledPar[R, E, A, B, C, D](zio1: ⇒ ZIO[R, E, A], zio2: ⇒ ZIO[R, E, B], zio3: ⇒ ZIO[R, E, C], zio4: ⇒ ZIO[R, E, D])(implicit trace: ZTraceElement): ZIO[R, E, (A, B, C, D)]
Zips the specified effects in parallel.
Zips the specified effects in parallel. Specialized version of mapParN.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use zipPar
-
def
tupledPar[R, E, A, B, C](zio1: ⇒ ZIO[R, E, A], zio2: ⇒ ZIO[R, E, B], zio3: ⇒ ZIO[R, E, C])(implicit trace: ZTraceElement): ZIO[R, E, (A, B, C)]
Zips the specified effects in parallel.
Zips the specified effects in parallel. Specialized version of mapParN.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use zipPar
-
def
tupledPar[R, E, A, B](zio1: ⇒ ZIO[R, E, A], zio2: ⇒ ZIO[R, E, B])(implicit trace: ZTraceElement): ZIO[R, E, (A, B)]
Zips the specified effects in parallel.
Zips the specified effects in parallel. Specialized version of mapParN.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use zipPar
-
def
unlessM[R, E](p: ⇒ ZIO[R, E, Boolean]): UnlessZIO[R, E]
The moral equivalent of
if (!p) exp
whenp
has side-effectsThe moral equivalent of
if (!p) exp
whenp
has side-effects- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use unlessZIO
-
def
validatePar_[R, E, A](in: ⇒ Iterable[A])(f: (A) ⇒ ZIO[R, E, Any])(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R, ::[E], Unit]
Feeds elements of type
A
tof
in parallel and accumulates all errors, discarding the successes.Feeds elements of type
A
tof
in parallel and accumulates all errors, discarding the successes.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use validateParDiscard
-
def
validate_[R, E, A](in: ⇒ Iterable[A])(f: (A) ⇒ ZIO[R, E, Any])(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R, ::[E], Unit]
Feeds elements of type
A
tof
and accumulates all errors, discarding the successes.Feeds elements of type
A
tof
and accumulates all errors, discarding the successes.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use validateDiscard
-
def
whenCaseM[R, E, A, B](a: ⇒ ZIO[R, E, A])(pf: PartialFunction[A, ZIO[R, E, B]])(implicit trace: ZTraceElement): ZIO[R, E, Option[B]]
Runs an effect when the supplied
PartialFunction
matches for the given effectful value, otherwise does nothing.Runs an effect when the supplied
PartialFunction
matches for the given effectful value, otherwise does nothing.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use whenCaseZIO
-
def
whenM[R, E](p: ⇒ ZIO[R, E, Boolean]): WhenZIO[R, E]
The moral equivalent of
if (p) exp
whenp
has side-effectsThe moral equivalent of
if (p) exp
whenp
has side-effects- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use whenZIO