ZIO

zio.ZIO
See theZIO companion trait

Attributes

Companion
trait
Graph
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Show all
Self type
ZIO.type

Members list

Type members

Classlikes

final class Acquire[-R, +E, +A](acquire: () => ZIO[R, E, A]) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any
final class AcquireExit[-R, +E, +A](acquire: () => ZIO[R, E, A]) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any
abstract class CanFilter[+E]

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object CanFilter

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
CanFilter.type
object Continuation

Attributes

Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
final class EnvironmentWithPartiallyApplied[R](dummy: Boolean) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any
final class EnvironmentWithZIOPartiallyApplied[R](dummy: Boolean) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
sealed trait FinalizersRestorer

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Identity.type
object MakeParallel.type
object MakeSequential.type
final class GetStateWithPartiallyApplied[S](dummy: Boolean) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any
final class Grafter(scope: FiberScope) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any
final class IfZIO[R, E](b: () => ZIO[R, E, Boolean]) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object MakeInterruptible.type
object MakeUninterruptible.type
final class LogAnnotate(val annotations: () => Set[LogAnnotation])

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
final class LogSpan(val label: () => String) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
sealed trait ParallelismRestorer

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
final class ProvideSomeLayer[R0, -R, +E, +A](self: ZIO[R, E, A]) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any
final class Release[-R, +E, +A](acquire: () => ZIO[R, E, A], release: A => URIO[R, Any])

Attributes

Supertypes
class Object
trait Matchable
class Any
final class ReleaseExit[-R, +E, E1, +A, B](acquire: () => ZIO[R, E, A], release: (A, Exit[E1, B]) => URIO[R, Any])

Attributes

Supertypes
class Object
trait Matchable
class Any
final class ScopedPartiallyApplied[R](dummy: Boolean) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any
final class ServiceAtPartiallyApplied[Service](dummy: Boolean) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any
final class ServiceWithPartiallyApplied[Service](dummy: Boolean) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any
final class ServiceWithZIOPartiallyApplied[Service](dummy: Boolean) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any
final class StatefulPartiallyApplied[R](dummy: Boolean) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any
final class StatefulPatchPartiallyApplied[R](dummy: Boolean) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any
final class Tagged(val tags: () => Set[MetricLabel])

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
final class TimeoutTo[-R, +E, +A, +B](self: ZIO[R, E, A], b: () => B)

Attributes

Supertypes
class Object
trait Matchable
class Any
final class UnlessZIO[R, E](b: () => ZIO[R, E, Boolean]) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any
final class UpdateService[-R, +E, +A, M](self: ZIO[R, E, A]) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any
final class UpdateServiceAt[-R, +E, +A, Service](self: ZIO[R, E, A]) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any
final class UsingPartiallyApplied[R](dummy: Boolean) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any
final class WhenZIO[R, E](b: () => ZIO[R, E, Boolean]) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any
final implicit class ZIOAutoCloseableOps[R, E, A <: AutoCloseable](io: ZIO[R, E, A]) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any
final implicit class ZIOBooleanOps[R, E](self: ZIO[R, E, Boolean]) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Show all
Self type
sealed trait ZIOConstructor[-Environment, +Error, In]

A ZIOConstructor[Input] knows how to construct a ZIO value from an input of type Input. This allows the type of the ZIO value constructed to depend on Input. The constructed ZIO value is guaranteed not to require any services not included in Environment or to be able to fail in any ways not described by Error.

A ZIOConstructor[Input] knows how to construct a ZIO value from an input of type Input. This allows the type of the ZIO value constructed to depend on Input. The constructed ZIO value is guaranteed not to require any services not included in Environment or to be able to fail in any ways not described by Error.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
object ZIOConstructor.type

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
final implicit class ZioRefineToOrDieOps[R, E <: Throwable, A](self: ZIO[R, E, A]) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any

Inherited types

The names of the product elements

The names of the product elements

Attributes

Inherited from:
Mirror

The name of the type

The name of the type

Attributes

Inherited from:
Mirror

Value members

Concrete methods

def absolve[R, E, A](v: => ZIO[R, E, Either[E, A]])(implicit trace: Trace): ZIO[R, E, A]

Submerges the error case of an Either into the ZIO. The inverse operation of IO.either.

Submerges the error case of an Either into the ZIO. The inverse operation of IO.either.

Attributes

def acquireRelease[R, R1, E, A](acquire: => ZIO[R, E, A])(release: A => ZIO[R1, Nothing, Any])(implicit trace: Trace): ZIO[R & R1 & Scope, E, A]

Constructs a scoped resource from an acquire and release effect. If acquire successfully completes execution then release will be added to the finalizers associated with the scope of this effect and is guaranteed to be run when the scope is closed.

Constructs a scoped resource from an acquire and release effect. If acquire successfully completes execution then release 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 and release effects will be run uninterruptibly.

Attributes

def acquireReleaseExit[R, R1, E, A](acquire: => ZIO[R, E, A])(release: (A, Exit[Any, Any]) => ZIO[R1, Nothing, Any])(implicit trace: Trace): ZIO[R & R1 & Scope, E, A]

A more powerful variant of acquireRelease that allows the release effect to depend on the Exit value specified when the scope is closed.

A more powerful variant of acquireRelease that allows the release effect to depend on the Exit value specified when the scope is closed.

Attributes

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. Neither the acquisition nor the release will be interrupted, and the resource is guaranteed to be released, so long as the acquire effect succeeds. If use fails, then after release, the returned effect will fail with the same error.

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. If use fails, then after release, the returned effect will fail with the same error.

Attributes

def acquireReleaseInterruptible[R, R1, E, A](acquire: => ZIO[R, E, A])(release: ZIO[R1, Nothing, Any])(implicit trace: Trace): ZIO[R & R1 & Scope, E, A]

A variant of acquireRelease that allows the acquire effect to be interruptible. Since the acquire effect could be interrupted after partially acquiring resources, the release effect is not allowed to access the resource produced by acquire and must independently determine what finalization, if any, needs to be performed (e.g. by examining in memory state).

A variant of acquireRelease that allows the acquire effect to be interruptible. Since the acquire effect could be interrupted after partially acquiring resources, the release effect is not allowed to access the resource produced by acquire and must independently determine what finalization, if any, needs to be performed (e.g. by examining in memory state).

Attributes

def acquireReleaseInterruptibleExit[R, R1, E, A](acquire: => ZIO[R, E, A])(release: Exit[Any, Any] => ZIO[R1, Nothing, Any])(implicit trace: Trace): ZIO[R & R1 & Scope, E, A]

A more powerful variant of acquireReleaseInterruptible that allows the release effect to depend on the Exit value specified when the scope is closed.

A more powerful variant of acquireReleaseInterruptible that allows the release effect to depend on the Exit value specified when the scope is closed.

Attributes

def acquireReleaseWith[R, E, A](acquire: => ZIO[R, E, A]): Acquire[R, E, A]

Given an effect representing 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.

Given an effect representing 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:

  1. Ensures this acquire effect 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 the use effect succeeds. If this fail-fast behavior is not desired, errors produced by the release effect can be caught and ignored.

ZIO.acquireReleaseWith(openFile("data.json"))(closeFile) { file =>
 for {
   header <- readHeader(file)
   ...
 } yield result
}

Attributes

def addFinalizer[R](finalizer: => URIO[R, Any])(implicit trace: Trace): ZIO[R & Scope, Nothing, Any]

Adds a finalizer to the scope of this effect. The finalizer is guaranteed to be run when the scope is closed.

Adds a finalizer to the scope of this effect. The finalizer is guaranteed to be run when the scope is closed.

Attributes

def addFinalizerExit[R](finalizer: Exit[Any, Any] => URIO[R, Any])(implicit trace: Trace): ZIO[R & Scope, Nothing, Any]

A more powerful variant of addFinalizer that allows the finalizer to depend on the Exit value that the scope is closed with.

A more powerful variant of addFinalizer that allows the finalizer to depend on the Exit value that the scope is closed with.

Attributes

def allowInterrupt(implicit trace: Trace): UIO[Unit]

Makes an explicit check to see if the fiber has been interrupted, and if so, performs self-interruption

Makes an explicit check to see if the fiber has been interrupted, and if so, performs self-interruption

Attributes

def asyncInterruptUnsafe[R, E, A](register: Unsafe => (ZIO[R, E, A] => Unit) => Either[URIO[R, Any], ZIO[R, E, A]], blockingOn: => FiberId)(implicit trace: Trace): ZIO[R, E, A]
def asyncZIO[R, E, A](register: (ZIO[R, E, A] => Unit) => ZIO[R, E, Any])(implicit trace: Trace): ZIO[R, E, A]

Converts an asynchronous, callback-style API into a ZIO effect, which will be executed asynchronously.

Converts an asynchronous, callback-style API into a ZIO effect, which will be executed asynchronously.

With this variant, the registration function may return a ZIO effect.

Attributes

def attemptBlockingIOUnsafe[A](effect: Unsafe => A)(implicit trace: Trace): IO[IOException, A]
def attemptUnsafe[A](a: Unsafe => A)(implicit trace: Trace): Task[A]
def blocking[R, E, A](zio: => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]

Returns a new effect that, when executed, will execute the original effect on the blocking thread pool.

Returns a new effect that, when executed, will execute the original effect on the blocking thread pool.

Attributes

def blockingExecutor(implicit trace: Trace): UIO[Executor]

Retrieves the executor for all blocking tasks.

Retrieves the executor for all blocking tasks.

Attributes

def checkInterruptible[R, E, A](f: InterruptStatus => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]

Checks the interrupt status, and produces the effect returned by the specified callback.

Checks the interrupt status, and produces the effect returned by the specified callback.

Attributes

def clock(implicit trace: Trace): UIO[Clock]

Retrieves the Clock service for this workflow.

Retrieves the Clock service for this workflow.

Attributes

def clockWith[R, E, A](f: Clock => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]

Retrieves the Clock service for this workflow and uses it to run the specified workflow.

Retrieves the Clock service for this workflow and uses it to run the specified workflow.

Attributes

def collect[R, E, A, B, Collection <: (Iterable)](in: Collection[A])(f: A => ZIO[R, Option[E], B])(implicit bf: BuildFrom[Collection[A], B, Collection[B]], trace: Trace): 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. For a parallel version, see collectPar.

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.

Attributes

def collect[R, E, Key, Key2, Value, Value2](map: Map[Key, Value])(f: (Key, Value) => ZIO[R, Option[E], (Key2, Value2)])(implicit trace: Trace): 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. For a parallel version, see collectPar.

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.

Attributes

def collectAll[R, E, A, Collection <: (Iterable)](in: Collection[ZIO[R, E, A]])(implicit bf: BuildFrom[Collection[ZIO[R, E, A]], A, Collection[A]], trace: Trace): ZIO[R, E, Collection[A]]

Evaluate each effect in the structure from left to right, and collect the results. For a parallel version, see collectAllPar.

Evaluate each effect in the structure from left to right, and collect the results. For a parallel version, see collectAllPar.

Attributes

def collectAll[R, E, A](in: Set[ZIO[R, E, A]])(implicit trace: Trace): ZIO[R, E, Set[A]]

Evaluate each effect in the structure from left to right, and collect the results. For a parallel version, see collectAllPar.

Evaluate each effect in the structure from left to right, and collect the results. For a parallel version, see collectAllPar.

Attributes

def collectAll[R, E, A : ClassTag](in: Array[ZIO[R, E, A]])(implicit evidence$111: ClassTag[A], trace: Trace): ZIO[R, E, Array[A]]

Evaluate each effect in the structure from left to right, and collect the results. For a parallel version, see collectAllPar.

Evaluate each effect in the structure from left to right, and collect the results. For a parallel version, see collectAllPar.

Attributes

def collectAll[R, E, A](in: Option[ZIO[R, E, A]])(implicit trace: Trace): ZIO[R, E, Option[A]]

Evaluate effect if present, and return its result as Option[A].

Evaluate effect if present, and return its result as Option[A].

Attributes

def collectAll[R, E, A](in: NonEmptyChunk[ZIO[R, E, A]])(implicit trace: Trace): ZIO[R, E, NonEmptyChunk[A]]

Evaluate each effect in the structure from left to right, and collect the results. For a parallel version, see collectAllPar.

Evaluate each effect in the structure from left to right, and collect the results. For a parallel version, see collectAllPar.

Attributes

def collectAllDiscard[R, E, A](in: => Iterable[ZIO[R, E, A]])(implicit trace: Trace): ZIO[R, E, Unit]

Evaluate each effect in the structure from left to right, and discard the results. For a parallel version, see collectAllParDiscard.

Evaluate each effect in the structure from left to right, and discard the results. For a parallel version, see collectAllParDiscard.

Attributes

def collectAllPar[R, E, A, Collection <: (Iterable)](as: Collection[ZIO[R, E, A]])(implicit bf: BuildFrom[Collection[ZIO[R, E, A]], A, Collection[A]], trace: Trace): ZIO[R, E, Collection[A]]

Evaluate each effect in the structure in parallel, and collect the results. For a sequential version, see collectAll.

Evaluate each effect in the structure in parallel, and collect the results. For a sequential version, see collectAll.

Attributes

def collectAllPar[R, E, A](as: Set[ZIO[R, E, A]])(implicit trace: Trace): ZIO[R, E, Set[A]]

Evaluate each effect in the structure in parallel, and collect the results. For a sequential version, see collectAll.

Evaluate each effect in the structure in parallel, and collect the results. For a sequential version, see collectAll.

Attributes

def collectAllPar[R, E, A : ClassTag](as: Array[ZIO[R, E, A]])(implicit evidence$112: ClassTag[A], trace: Trace): ZIO[R, E, Array[A]]

Evaluate each effect in the structure in parallel, and collect the results. For a sequential version, see collectAll.

Evaluate each effect in the structure in parallel, and collect the results. For a sequential version, see collectAll.

Attributes

def collectAllPar[R, E, A](as: NonEmptyChunk[ZIO[R, E, A]])(implicit trace: Trace): ZIO[R, E, NonEmptyChunk[A]]

Evaluate each effect in the structure in parallel, and collect the results. For a sequential version, see collectAll.

Evaluate each effect in the structure in parallel, and collect the results. For a sequential version, see collectAll.

Attributes

def collectAllParDiscard[R, E, A](as: => Iterable[ZIO[R, E, A]])(implicit trace: Trace): ZIO[R, E, Unit]

Evaluate each effect in the structure in parallel, and discard the results. For a sequential version, see collectAllDiscard.

Evaluate each effect in the structure in parallel, and discard the results. For a sequential version, see collectAllDiscard.

Attributes

def collectAllSuccesses[R, E, A, Collection <: (Iterable)](in: Collection[ZIO[R, E, A]])(implicit bf: BuildFrom[Collection[ZIO[R, E, A]], A, Collection[A]], trace: Trace): URIO[R, Collection[A]]

Evaluate and run each effect in the structure and collect discarding failed ones.

Evaluate and run each effect in the structure and collect discarding failed ones.

Attributes

def collectAllSuccessesPar[R, E, A, Collection <: (Iterable)](in: Collection[ZIO[R, E, A]])(implicit bf: BuildFrom[Collection[ZIO[R, E, A]], A, Collection[A]], trace: Trace): 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.

Attributes

def collectAllWith[R, E, A, B, Collection <: (Iterable)](in: Collection[ZIO[R, E, A]])(f: PartialFunction[A, B])(implicit bf: BuildFrom[Collection[ZIO[R, E, A]], B, Collection[B]], trace: Trace): ZIO[R, E, Collection[B]]

Evaluate each effect in the structure with collectAll, and collect the results with given partial function.

Evaluate each effect in the structure with collectAll, and collect the results with given partial function.

Attributes

def collectAllWithPar[R, E, A, U, Collection <: (Iterable)](in: Collection[ZIO[R, E, A]])(f: PartialFunction[A, U])(implicit bf: BuildFrom[Collection[ZIO[R, E, A]], U, Collection[U]], trace: Trace): ZIO[R, E, Collection[U]]

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.

Attributes

def collectFirst[R, E, A, B](as: => Iterable[A])(f: A => ZIO[R, E, Option[B]])(implicit trace: Trace): ZIO[R, E, Option[B]]

Collects the first element of the Iterable[A] for which the effectual function f returns Some.

Collects the first element of the Iterable[A] for which the effectual function f returns Some.

Attributes

def collectPar[R, E, A, B, Collection <: (Iterable)](in: Collection[A])(f: A => ZIO[R, Option[E], B])(implicit bf: BuildFrom[Collection[A], B, Collection[B]], trace: Trace): 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.

Attributes

def collectPar[R, E, Key, Key2, Value, Value2](map: Map[Key, Value])(f: (Key, Value) => ZIO[R, Option[E], (Key2, Value2)])(implicit trace: Trace): 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. For a parallel version, see collectPar.

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.

Attributes

def cond[E, A](predicate: => Boolean, result: => A, error: => E)(implicit trace: Trace): 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

Attributes

def config[A](config: Config[A])(implicit trace: Trace): ZIO[Any, Error, A]

Uses the current config provider to load the specified config, or fail with an error of type Config.Error.

Uses the current config provider to load the specified config, or fail with an error of type Config.Error.

Attributes

def configProviderWith[R, E, A](f: ConfigProvider => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]

Retrieves the current config provider, and passes it to the specified function, which may return an effect that uses the provider to perform some work or compute some value.

Retrieves the current config provider, and passes it to the specified function, which may return an effect that uses the provider to perform some work or compute some value.

Attributes

def console(implicit trace: Trace): UIO[Console]

Retrieves the Console service for this workflow.

Retrieves the Console service for this workflow.

Attributes

def consoleWith[R, E, A](f: Console => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]

Retrieves the Console service for this workflow and uses it to run the specified workflow.

Retrieves the Console service for this workflow and uses it to run the specified workflow.

Attributes

def debug(value: => Any)(implicit trace: Trace): UIO[Unit]

Prints the specified message to the console for debugging purposes.

Prints the specified message to the console for debugging purposes.

Attributes

def descriptor(implicit trace: Trace): UIO[Descriptor]

Returns information about the current fiber, such as its identity.

Returns information about the current fiber, such as its identity.

Attributes

def descriptorWith[R, E, A](f: Descriptor => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]

Constructs an effect based on information about the current fiber, such as its identity.

Constructs an effect based on information about the current fiber, such as its identity.

Attributes

def die(t: => Throwable)(implicit trace: Trace): UIO[Nothing]

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.

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.

Attributes

def dieMessage(message: => String)(implicit trace: Trace): UIO[Nothing]

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.

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.

Attributes

def done[E, A](r: => Exit[E, A])(implicit trace: Trace): IO[E, A]

Returns an effect from a zio.Exit value.

Returns an effect from a zio.Exit value.

Attributes

def environment[R](implicit trace: Trace): URIO[R, ZEnvironment[R]]

Accesses the whole environment of the effect.

Accesses the whole environment of the effect.

Attributes

Accesses the environment of the effect.

Accesses the environment of the effect.

Attributes

Effectually accesses the environment of the effect.

Effectually accesses the environment of the effect.

Attributes

def executor(implicit trace: Trace): UIO[Executor]

Retrieves the executor for this effect.

Retrieves the executor for this effect.

Attributes

def executorWith[R, E, A](f: Executor => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]

Constructs an effect based on the current executor.

Constructs an effect based on the current executor.

Attributes

def exists[R, E, A](as: => Iterable[A])(f: A => ZIO[R, E, Boolean])(implicit trace: Trace): ZIO[R, E, Boolean]

Determines whether any element of the Iterable[A] satisfies the effectual predicate f.

Determines whether any element of the Iterable[A] satisfies the effectual predicate f.

Attributes

def fail[E](error: => E)(implicit trace: Trace): IO[E, Nothing]

Returns an effect that models failure with the specified error. The moral equivalent of throw for pure code.

Returns an effect that models failure with the specified error. The moral equivalent of throw for pure code.

Attributes

def failCause[E](cause: => Cause[E])(implicit trace0: Trace): IO[E, Nothing]

Returns an effect that models failure with the specified Cause.

Returns an effect that models failure with the specified Cause.

Attributes

def fiberId(implicit trace: Trace): UIO[Runtime]

Returns the FiberId of the fiber executing the effect that calls this method.

Returns the FiberId of the fiber executing the effect that calls this method.

Attributes

def fiberIdWith[R, E, A](f: Runtime => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]

Constructs an effect based on the FiberId of the fiber executing the effect that calls this method.

Constructs an effect based on the FiberId of the fiber executing the effect that calls this method.

Attributes

def filter[R, E, A, Collection <: (Iterable)](as: Collection[A])(f: A => ZIO[R, E, Boolean])(implicit bf: BuildFrom[Collection[A], A, Collection[A]], trace: Trace): ZIO[R, E, Collection[A]]

Filters the collection using the specified effectual predicate.

Filters the collection using the specified effectual predicate.

Attributes

def filter[R, E, A](as: Set[A])(f: A => ZIO[R, E, Boolean])(implicit trace: Trace): ZIO[R, E, Set[A]]

Filters the Set[A] using the specified effectual predicate.

Filters the Set[A] using the specified effectual predicate.

Attributes

def filterNot[R, E, A, Collection <: (Iterable)](as: Collection[A])(f: A => ZIO[R, E, Boolean])(implicit bf: BuildFrom[Collection[A], A, Collection[A]], trace: Trace): ZIO[R, E, Collection[A]]

Filters the collection using the specified effectual predicate, removing all elements that satisfy the predicate.

Filters the collection using the specified effectual predicate, removing all elements that satisfy the predicate.

Attributes

def filterNot[R, E, A](as: Set[A])(f: A => ZIO[R, E, Boolean])(implicit trace: Trace): ZIO[R, E, Set[A]]

Filters the Set[A] using the specified effectual predicate, removing all elements that satisfy the predicate.

Filters the Set[A] using the specified effectual predicate, removing all elements that satisfy the predicate.

Attributes

def filterNotPar[R, E, A, Collection <: (Iterable)](as: Collection[A])(f: A => ZIO[R, E, Boolean])(implicit bf: BuildFrom[Collection[A], A, Collection[A]], trace: Trace): 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 for a sequential version.

Attributes

def filterNotPar[R, E, A](as: Set[A])(f: A => ZIO[R, E, Boolean])(implicit trace: Trace): 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] for a sequential version.

Attributes

def filterPar[R, E, A, Collection <: (Iterable)](as: Collection[A])(f: A => ZIO[R, E, Boolean])(implicit bf: BuildFrom[Collection[A], A, Collection[A]], trace: Trace): 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 for a sequential version.

Attributes

def filterPar[R, E, A](as: Set[A])(f: A => ZIO[R, E, Boolean])(implicit trace: Trace): 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 for a sequential version.

Attributes

def firstSuccessOf[R, R1 <: R, E, A](zio: => ZIO[R, E, A], rest: => Iterable[ZIO[R1, E, A]])(implicit trace: Trace): 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.

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.

Attributes

def flatten[R, E, A](zio: => ZIO[R, E, ZIO[R, E, A]])(implicit trace: Trace): 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.

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.

Attributes

def foldLeft[R, E, S, A](in: => Iterable[A])(zero: => S)(f: (S, A) => ZIO[R, E, S])(implicit trace: Trace): ZIO[R, E, S]

Folds an Iterable[A] using an effectual function f, working sequentially from left to right.

Folds an Iterable[A] using an effectual function f, working sequentially from left to right.

Attributes

def foldRight[R, E, S, A](in: => Iterable[A])(zero: => S)(f: (A, S) => ZIO[R, E, S])(implicit trace: Trace): ZIO[R, E, S]

Folds an Iterable[A] using an effectual function f, working sequentially from right to left.

Folds an Iterable[A] using an effectual function f, working sequentially from right to left.

Attributes

def forall[R, E, A](as: => Iterable[A])(f: A => ZIO[R, E, Boolean])(implicit trace: Trace): ZIO[R, E, Boolean]

Determines whether all elements of the Iterable[A] satisfy the effectual predicate f.

Determines whether all elements of the Iterable[A] satisfy the effectual predicate f.

Attributes

def foreach[R, E, A, B, Collection <: (Iterable)](in: Collection[A])(f: A => ZIO[R, E, B])(implicit bf: BuildFrom[Collection[A], B, Collection[B]], trace: Trace): ZIO[R, E, Collection[B]]

Applies the function f to each element of the Collection[A] and returns the results in a new Collection[B].

Applies the function f to each element of the Collection[A] and returns the results in a new Collection[B].

For a parallel version of this method, see foreachPar. If you do not need the results, see foreachDiscard for a more efficient implementation.

Attributes

final def foreach[R, E, A, B](in: Set[A])(f: A => ZIO[R, E, B])(implicit trace: Trace): ZIO[R, E, Set[B]]

Applies the function f to each element of the Set[A] and returns the results in a new Set[B].

Applies the function f to each element of the Set[A] and returns the results in a new Set[B].

For a parallel version of this method, see foreachPar. If you do not need the results, see foreachDiscard for a more efficient implementation.

Attributes

final def foreach[R, E, A, B : ClassTag](in: Array[A])(f: A => ZIO[R, E, B])(implicit evidence$113: ClassTag[B], trace: Trace): ZIO[R, E, Array[B]]

Applies the function f to each element of the Array[A] and returns the results in a new Array[B].

Applies the function f to each element of the Array[A] and returns the results in a new Array[B].

For a parallel version of this method, see foreachPar. If you do not need the results, see foreachDiscard for a more efficient implementation.

Attributes

def foreach[R, E, Key, Key2, Value, Value2](map: Map[Key, Value])(f: (Key, Value) => ZIO[R, E, (Key2, Value2)])(implicit trace: Trace): ZIO[R, E, Map[Key2, Value2]]

Applies the function f to each element of the Map[Key, Value] and returns the results in a new Map[Key2, Value2].

Applies the function f to each element of the Map[Key, Value] and returns the results in a new Map[Key2, Value2].

For a parallel version of this method, see foreachPar. If you do not need the results, see foreachDiscard for a more efficient implementation.

Attributes

final def foreach[R, E, A, B](in: Option[A])(f: A => ZIO[R, E, B])(implicit trace: Trace): ZIO[R, E, Option[B]]

Applies the function f if the argument is non-empty and returns the results in a new Option[B].

Applies the function f if the argument is non-empty and returns the results in a new Option[B].

Attributes

final def foreach[R, E, A, B](in: NonEmptyChunk[A])(f: A => ZIO[R, E, B])(implicit trace: Trace): ZIO[R, E, NonEmptyChunk[B]]

Applies the function f to each element of the NonEmptyChunk[A] and returns the results in a new NonEmptyChunk[B].

Applies the function f to each element of the NonEmptyChunk[A] and returns the results in a new NonEmptyChunk[B].

For a parallel version of this method, see foreachPar. If you do not need the results, see foreachDiscard for a more efficient implementation.

Attributes

def foreachDiscard[R, E, A](as: => Iterable[A])(f: A => ZIO[R, E, Any])(implicit trace: Trace): ZIO[R, E, Unit]

Applies the function f to each element of the Iterable[A] and runs produced effects sequentially.

Applies the function f to each element of the Iterable[A] and runs produced effects sequentially.

Equivalent to foreach(as)(f).unit, but without the cost of building the list of results.

Attributes

final def foreachExec[R, E, A, B, Collection <: (Iterable)](as: Collection[A])(exec: => ExecutionStrategy)(f: A => ZIO[R, E, B])(implicit bf: BuildFrom[Collection[A], B, Collection[B]], trace: Trace): ZIO[R, E, Collection[B]]

Applies the function f to each element of the Collection[A] and returns the result in a new Collection[B] using the specified execution strategy.

Applies the function f to each element of the Collection[A] and returns the result in a new Collection[B] using the specified execution strategy.

Attributes

def foreachPar[R, E, A, B, Collection <: (Iterable)](as: Collection[A])(f: A => ZIO[R, E, B])(implicit bf: BuildFrom[Collection[A], B, Collection[B]], trace: Trace): ZIO[R, E, Collection[B]]

Applies the function f to each element of the Collection[A] in parallel, and returns the results in a new Collection[B].

Applies the function f to each element of the Collection[A] in parallel, and returns the results in a new Collection[B].

For a sequential version of this method, see foreach.

Attributes

final def foreachPar[R, E, A, B](as: Set[A])(fn: A => ZIO[R, E, B])(implicit trace: Trace): ZIO[R, E, Set[B]]

Applies the function f to each element of the Set[A] in parallel, and returns the results in a new Set[B].

Applies the function f to each element of the Set[A] in parallel, and returns the results in a new Set[B].

For a sequential version of this method, see foreach.

Attributes

final def foreachPar[R, E, A, B : ClassTag](as: Array[A])(f: A => ZIO[R, E, B])(implicit evidence$114: ClassTag[B], trace: Trace): ZIO[R, E, Array[B]]

Applies the function f to each element of the Array[A] in parallel, and returns the results in a new Array[B].

Applies the function f to each element of the Array[A] in parallel, and returns the results in a new Array[B].

For a sequential version of this method, see foreach.

Attributes

def foreachPar[R, E, Key, Key2, Value, Value2](map: Map[Key, Value])(f: (Key, Value) => ZIO[R, E, (Key2, Value2)])(implicit trace: Trace): ZIO[R, E, Map[Key2, Value2]]

Applies the function f to each element of the Map[Key, Value] in parallel and returns the results in a new Map[Key2, Value2].

Applies the function f to each element of the Map[Key, Value] in parallel and returns the results in a new Map[Key2, Value2].

For a sequential version of this method, see foreach.

Attributes

final def foreachPar[R, E, A, B](as: NonEmptyChunk[A])(fn: A => ZIO[R, E, B])(implicit trace: Trace): ZIO[R, E, NonEmptyChunk[B]]

Applies the function f to each element of the NonEmptyChunk[A] in parallel, and returns the results in a new NonEmptyChunk[B].

Applies the function f to each element of the NonEmptyChunk[A] in parallel, and returns the results in a new NonEmptyChunk[B].

For a sequential version of this method, see foreach.

Attributes

def foreachParDiscard[R, E, A](as: => Iterable[A])(f: A => ZIO[R, E, Any])(implicit trace: Trace): ZIO[R, E, Unit]

Applies the function f to each element of the Iterable[A] and runs produced effects in parallel, discarding the results.

Applies the function f to each element of the Iterable[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.

Attributes

def forkAll[R, E, A, Collection <: (Iterable)](as: Collection[ZIO[R, E, A]])(implicit bf: BuildFrom[Collection[ZIO[R, E, A]], A, Collection[A]], trace: Trace): 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.

Returns an effect that forks all of the specified values, and returns a composite fiber that produces a list of their results, in order.

Attributes

def forkAllDiscard[R, E, A](as: => Iterable[ZIO[R, E, A]])(implicit trace: Trace): URIO[R, Fiber[E, 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.

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.

Attributes

def from[Input](input: => Input)(implicit constructor: ZIOConstructor[Nothing, Any, Input], trace: Trace): ZIO[OutEnvironment, OutError, OutSuccess]

Constructs a ZIO value of the appropriate type for the specified input.

Constructs a ZIO value of the appropriate type for the specified input.

Attributes

def fromAutoCloseable[R, E, A <: AutoCloseable](fa: => ZIO[R, E, A])(implicit trace: Trace): ZIO[R & Scope, E, A]
def fromEither[E, A](v: => Either[E, A])(implicit trace: Trace): IO[E, A]

Lifts an Either into a ZIO value.

Lifts an Either into a ZIO value.

Attributes

def fromEitherCause[E, A](v: => Either[Cause[E], A])(implicit trace: Trace): IO[E, A]

Lifts an Either into a ZIO value.

Lifts an Either into a ZIO value.

Attributes

def fromFiber[E, A](fiber: => Fiber[E, A])(implicit trace: Trace): 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.

Attributes

def fromFiberZIO[R, E, A](fiber: => ZIO[R, E, Fiber[E, A]])(implicit trace: Trace): ZIO[R, 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.

Attributes

def fromFuture[A](make: ExecutionContext => Future[A])(implicit trace: Trace): Task[A]

Returns an effect that, when executed, will both create and launch a scala.concurrent.Future, feeding it an scala.concurrent.ExecutionContext that is backed by ZIO's own executor.

Returns an effect that, when executed, will both create and launch a scala.concurrent.Future, feeding it an scala.concurrent.ExecutionContext that is backed by ZIO's own executor.

Attributes

def fromFutureInterrupt[A](make: ExecutionContext => Future[A])(implicit trace: Trace): Task[A]

Imports a function that creates a scala.concurrent.Future from an scala.concurrent.ExecutionContext into a ZIO. The provided ExecutionContext will interrupt the Future between asynchronous operations such as map and flatMap if this effect is interrupted. Note that no attempt will be made to interrupt a Future blocking on a synchronous operation and that the Future must be created using the provided ExecutionContext.

Imports a function that creates a scala.concurrent.Future from an scala.concurrent.ExecutionContext into a ZIO. The provided ExecutionContext will interrupt the Future between asynchronous operations such as map and flatMap if this effect is interrupted. Note that no attempt will be made to interrupt a Future blocking on a synchronous operation and that the Future must be created using the provided ExecutionContext.

Attributes

def fromOption[A](v: => Option[A])(implicit trace: Trace): IO[Option[Nothing], A]

Lifts an Option into a ZIO but preserves the error as an option in the error channel, making it easier to compose in some scenarios.

Lifts an Option into a ZIO but preserves the error as an option in the error channel, making it easier to compose in some scenarios.

Attributes

def fromPromiseScala[A](promise: => Promise[A])(implicit trace: Trace): Task[A]

Imports a scala.concurrent.Promise we generate a future from promise, and we pass to [fromFuture] to transform into Task[A]

Imports a scala.concurrent.Promise we generate a future from promise, and we pass to [fromFuture] to transform into Task[A]

Attributes

def fromTry[A](value: => Try[A])(implicit trace: Trace): Task[A]

Lifts a Try into a ZIO.

Lifts a Try into a ZIO.

Attributes

def getFiberRefs(implicit trace: Trace): UIO[FiberRefs]

Returns a collection of all FiberRef values for the fiber running this effect.

Returns a collection of all FiberRef values for the fiber running this effect.

Attributes

final def getOrFail[A](v: => Option[A])(implicit trace: Trace): Task[A]

Lifts an Option into a ZIO, if the option is not defined it fails with NoSuchElementException.

Lifts an Option into a ZIO, if the option is not defined it fails with NoSuchElementException.

Attributes

final def getOrFailUnit[A](v: => Option[A])(implicit trace: Trace): IO[Unit, A]

Lifts an Option into a IO, if the option is not defined it fails with Unit.

Lifts an Option into a IO, if the option is not defined it fails with Unit.

Attributes

final def getOrFailWith[E, A](e: => E)(v: => Option[A])(implicit trace: Trace): IO[E, A]

Lifts an Option into a ZIO. If the option is not defined, fail with the e value.

Lifts an Option into a ZIO. If the option is not defined, fail with the e value.

Attributes

def getState[S : Tag](implicit evidence$115: Tag[S], trace: Trace): ZIO[ZState[S], Nothing, S]

Gets a state from the environment.

Gets a state from the environment.

Attributes

Gets a state from the environment and uses it to run the specified function.

Gets a state from the environment and uses it to run the specified function.

Attributes

def ifZIO[R, E](b: => ZIO[R, E, Boolean]): IfZIO[R, E]

Runs onTrue if the result of b is true and onFalse otherwise.

Runs onTrue if the result of b is true and onFalse otherwise.

Attributes

def infinity(implicit trace: Trace): UIO[Nothing]

Like never, but fibers that running this effect won't be garbage collected unless interrupted.

Like never, but fibers that running this effect won't be garbage collected unless interrupted.

Attributes

def inheritFiberRefs(childFiberRefs: FiberRefs)(implicit trace: Trace): UIO[Unit]

Inherits values from all FiberRef instances into current fiber.

Inherits values from all FiberRef instances into current fiber.

Attributes

def interrupt(implicit trace: Trace): UIO[Nothing]

Returns an effect that is interrupted as if by the fiber calling this method.

Returns an effect that is interrupted as if by the fiber calling this method.

Attributes

def interruptAs(fiberId: => FiberId)(implicit trace: Trace): UIO[Nothing]

Returns an effect that is interrupted as if by the specified fiber.

Returns an effect that is interrupted as if by the specified fiber.

Attributes

def interruptible[R, E, A](zio: => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]

Prefix form of ZIO#interruptible.

Prefix form of ZIO#interruptible.

Attributes

def interruptibleMask[R, E, A](k: InterruptibilityRestorer => ZIO[R, E, A])(implicit trace: Trace): 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.

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.

Attributes

def isFatal(implicit trace: Trace): UIO[Throwable => Boolean]

Retrieves the definition of a fatal error.

Retrieves the definition of a fatal error.

Attributes

def isFatalWith[R, E, A](f: (Throwable => Boolean) => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]

Constructs an effect based on the definition of a fatal error.

Constructs an effect based on the definition of a fatal error.

Attributes

def iterate[R, E, S](initial: => S)(cont: S => Boolean)(body: S => ZIO[R, E, S])(implicit trace: Trace): ZIO[R, E, S]

Iterates with the specified effectual function. The moral equivalent of:

Iterates with the specified effectual function. The moral equivalent of:

var s = initial

while (cont(s)) {
 s = body(s)
}

s

Attributes

def left[A](a: => A)(implicit trace: Trace): UIO[Either[A, Nothing]]

Returns an effect with the value on the left part.

Returns an effect with the value on the left part.

Attributes

def log(message: => String)(implicit trace: Trace): UIO[Unit]

Logs the specified message at the current log level.

Logs the specified message at the current log level.

Attributes

def logAnnotate(key: => String, value: => String): LogAnnotate

Annotates each log in this effect with the specified log annotation.

Annotates each log in this effect with the specified log annotation.

Attributes

def logAnnotate(logAnnotation: => LogAnnotation, logAnnotations: LogAnnotation*): LogAnnotate

Annotates each log in this effect with the specified log annotation.

Annotates each log in this effect with the specified log annotation.

Attributes

def logAnnotate(logAnnotations: => Set[LogAnnotation]): LogAnnotate

Annotates each log in this effect with the specified log annotation.

Annotates each log in this effect with the specified log annotation.

Attributes

def logAnnotateScoped(key: => String, value: => String)(implicit trace: Trace): ZIO[Scope, Nothing, Unit]
def logAnnotateScoped(logAnnotation: => LogAnnotation, logAnnotations: LogAnnotation*)(implicit trace: Trace): ZIO[Scope, Nothing, Unit]
def logAnnotateScoped(logAnnotations: => Set[LogAnnotation])(implicit trace: Trace): ZIO[Scope, Nothing, Unit]
def logAnnotations(implicit trace: Trace): UIO[Map[String, String]]

Retrieves the log annotations associated with the current scope.

Retrieves the log annotations associated with the current scope.

Attributes

def logCause(cause: => Cause[Any])(implicit trace: Trace): UIO[Unit]

Logs the specified cause at the current log level.

Logs the specified cause at the current log level.

Attributes

def logCause(message: => String, cause: => Cause[Any])(implicit trace: Trace): UIO[Unit]

Logs the specified message and cause at the current log level.

Logs the specified message and cause at the current log level.

Attributes

def logDebug(message: => String)(implicit trace: Trace): UIO[Unit]

Logs the specified message at the debug log level.

Logs the specified message at the debug log level.

Attributes

def logDebugCause(message: => String, cause: => Cause[Any])(implicit trace: Trace): UIO[Unit]

Logs the specified cause at the debug log level.

Logs the specified cause at the debug log level.

Attributes

def logDebugCause(cause: => Cause[Any])(implicit trace: Trace): UIO[Unit]

Logs the specified cause at the debug log level..

Logs the specified cause at the debug log level..

Attributes

def logError(message: => String)(implicit trace: Trace): UIO[Unit]

Logs the specified message at the error log level.

Logs the specified message at the error log level.

Attributes

def logErrorCause(message: => String, cause: => Cause[Any])(implicit trace: Trace): UIO[Unit]

Logs the specified cause as an error.

Logs the specified cause as an error.

Attributes

def logErrorCause(cause: => Cause[Any])(implicit trace: Trace): UIO[Unit]

Logs the specified cause as an error.

Logs the specified cause as an error.

Attributes

def logFatal(message: => String)(implicit trace: Trace): UIO[Unit]

Logs the specified message at the fatal log level.

Logs the specified message at the fatal log level.

Attributes

def logFatalCause(message: => String, cause: => Cause[Any])(implicit trace: Trace): UIO[Unit]

Logs the specified cause at the fatal log level.

Logs the specified cause at the fatal log level.

Attributes

def logFatalCause(cause: => Cause[Any])(implicit trace: Trace): UIO[Unit]

Logs the specified cause at the fatal log level.

Logs the specified cause at the fatal log level.

Attributes

def logInfo(message: => String)(implicit trace: Trace): UIO[Unit]

Logs the specified message at the informational log level.

Logs the specified message at the informational log level.

Attributes

def logInfoCause(message: => String, cause: => Cause[Any])(implicit trace: Trace): UIO[Unit]

Logs the specified cause at the informational log level.

Logs the specified cause at the informational log level.

Attributes

def logInfoCause(cause: => Cause[Any])(implicit trace: Trace): UIO[Unit]

Logs the specified cause at the informational log level..

Logs the specified cause at the informational log level..

Attributes

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!")
}

Attributes

def logLevelScoped(level: LogLevel)(implicit trace: Trace): ZIO[Scope, Nothing, Unit]
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) }

Attributes

def logSpanScoped(label: => String)(implicit trace: Trace): ZIO[Scope, Nothing, Unit]
def logSpans(implicit trace: Trace): UIO[List[LogSpan]]

Retrieves the log spans associated with the current scope.

Retrieves the log spans associated with the current scope.

Attributes

def logTrace(message: => String)(implicit trace: Trace): UIO[Unit]

Logs the specified message at the trace log level.

Logs the specified message at the trace log level.

Attributes

def logTraceCause(message: => String, cause: => Cause[Any])(implicit trace: Trace): UIO[Unit]

Logs the specified cause at the trace log level.

Logs the specified cause at the trace log level.

Attributes

def logTraceCause(cause: => Cause[Any])(implicit trace: Trace): UIO[Unit]

Logs the specified cause at the trace log level..

Logs the specified cause at the trace log level..

Attributes

def logWarning(message: => String)(implicit trace: Trace): UIO[Unit]

Logs the specified message at the warning log level.

Logs the specified message at the warning log level.

Attributes

def logWarningCause(message: => String, cause: => Cause[Any])(implicit trace: Trace): UIO[Unit]

Logs the specified cause at the warning log level.

Logs the specified cause at the warning log level.

Attributes

def logWarningCause(cause: => Cause[Any])(implicit trace: Trace): UIO[Unit]

Logs the specified cause at the warning log level..

Logs the specified cause at the warning log level..

Attributes

def loggers(implicit trace: Trace): UIO[Set[ZLogger[String, Any]]]

Retrieves the current loggers for this effect.

Retrieves the current loggers for this effect.

Attributes

def loggersWith[R, E, A](f: Set[ZLogger[String, Any]] => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]

Constructs an effect based on the current loggers.

Constructs an effect based on the current loggers.

Attributes

def loop[R, E, A, S](initial: => S)(cont: S => Boolean, inc: S => S)(body: S => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, List[A]]

Loops with the specified effectual function, collecting the results into a list. The moral equivalent of:

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

Attributes

def loopDiscard[R, E, S](initial: => S)(cont: S => Boolean, inc: S => S)(body: S => ZIO[R, E, Any])(implicit trace: Trace): ZIO[R, E, Unit]

Loops with the specified effectual function purely for its effects. The moral equivalent of:

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

Attributes

def memoize[R, E, A, B](f: A => ZIO[R, E, B])(implicit trace: Trace): UIO[A => ZIO[R, E, B]]

Returns a memoized version of the specified effectual function.

Returns a memoized version of the specified effectual function.

Attributes

def mergeAll[R, E, A, B](in: => Iterable[ZIO[R, E, A]])(zero: => B)(f: (B, A) => B)(implicit trace: Trace): ZIO[R, E, B]

Merges an Iterable[IO] to a single IO, working sequentially.

Merges an Iterable[IO] to a single IO, working sequentially.

Attributes

def mergeAllPar[R, E, A, B](in: => Iterable[ZIO[R, E, A]])(zero: => B)(f: (B, A) => B)(implicit trace: Trace): 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, as f may be executed more than once for some of in elements during effect execution.

Attributes

def metrics(implicit trace: Trace): UIO[Metrics]

Gets current metrics snapshot.

Gets current metrics snapshot.

Attributes

def never(implicit trace: Trace): UIO[Nothing]

Returns a effect that will never produce anything. The moral equivalent of while(true) {}, only without the wasted CPU cycles. Fibers that execute this effect will be automatically garbage collected on the JVM when no explicit references to them are held, because they cannot be reactivated.

Returns a effect that will never produce anything. The moral equivalent of while(true) {}, only without the wasted CPU cycles. Fibers that execute this effect will be automatically garbage collected on the JVM when no explicit references to them are held, because they cannot be reactivated.

Attributes

def noneOrFail[E](o: => Option[E])(implicit trace: Trace): IO[E, Unit]

Lifts an Option into a ZIO. If the option is empty it succeeds with Unit. If the option is defined it fails with the content.

Lifts an Option into a ZIO. If the option is empty it succeeds with Unit. If the option is defined it fails with the content.

Attributes

def noneOrFailWith[E, O](o: => Option[O])(f: O => E)(implicit trace: Trace): IO[E, Unit]

Lifts an Option into a ZIO. If the option is empty it succeeds with Unit. If the option is defined it fails with an error adapted with f.

Lifts an Option into a ZIO. If the option is empty it succeeds with Unit. If the option is defined it fails with an error adapted with f.

Attributes

def not[R, E](effect: => ZIO[R, E, Boolean])(implicit trace: Trace): ZIO[R, E, Boolean]

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

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

Attributes

def onExecutor[R, E, A](executor: => Executor)(zio: ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]

Returns an effect that will execute the specified effect fully on the provided executor, before potentially returning to the previous executor. See ZIO!.onExecutor.

Returns an effect that will execute the specified effect fully on the provided executor, before potentially returning to the previous executor. See ZIO!.onExecutor.

Attributes

def onExecutorScoped(executor: => Executor)(implicit trace: Trace): ZIO[Scope, Nothing, Unit]

Shifts execution to the specified executor and shifts it back to the previous executor, if any, when the scope is closed.

Shifts execution to the specified executor and shifts it back to the previous executor, if any, when the scope is closed.

Attributes

def parallelFinalizers[R, E, A](zio: => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]

Returns a new scoped workflow that runs finalizers added to the scope of this workflow in parallel.

Returns a new scoped workflow that runs finalizers added to the scope of this workflow in parallel.

Attributes

def parallelFinalizersMask[R, E, A](f: FinalizersRestorer => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]
def parallelism(implicit trace: Trace): UIO[Option[Int]]

Retrieves the maximum number of fibers for parallel operators or None if it is unbounded.

Retrieves the maximum number of fibers for parallel operators or None if it is unbounded.

Attributes

def parallelismWith[R, E, A](f: Option[Int] => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]

Retrieves the current maximum number of fibers for parallel operators and uses it to run the specified effect.

Retrieves the current maximum number of fibers for parallel operators and uses it to run the specified effect.

Attributes

def partition[R, E, A, B](in: => Iterable[A])(f: A => ZIO[R, E, B])(implicit ev: CanFail[E], trace: Trace): ZIO[R, Nothing, (Iterable[E], Iterable[B])]

Feeds elements of type A to a function f that returns an effect. Collects all successes and failures in a tupled fashion.

Feeds elements of type A to a function f that returns an effect. Collects all successes and failures in a tupled fashion.

Attributes

def partitionPar[R, E, A, B](in: => Iterable[A])(f: A => ZIO[R, E, B])(implicit ev: CanFail[E], trace: Trace): ZIO[R, Nothing, (Iterable[E], Iterable[B])]

Feeds elements of type A to a function f that returns an effect. Collects all successes and failures in parallel and returns the result as a tuple.

Feeds elements of type A to a function f that returns an effect. Collects all successes and failures in parallel and returns the result as a tuple.

Attributes

def patchFiberRefs(patch: Patch)(implicit trace: Trace): ZIO[Any, Nothing, Unit]

Applies the specified changes to the FiberRef values for the fiber running this workflow.

Applies the specified changes to the FiberRef values for the fiber running this workflow.

Attributes

def provideEnvironment[R, E, A](r: => ZEnvironment[R])(implicit trace: Trace): 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 as inject.

Attributes

def provideLayer[RIn, E, ROut, RIn2, ROut2](layer: ZLayer[RIn, E, ROut])(zio: ZIO[ROut & RIn2, E, ROut2])(implicit ev: Tag[RIn2], tag: Tag[ROut], trace: Trace): ZIO[RIn & RIn2, E, ROut2]
def raceAll[R, R1 <: R, E, A](zio: => ZIO[R, E, A], ios: => Iterable[ZIO[R1, E, A]])(implicit trace: Trace): ZIO[R1, E, A]

Races an IO[E, A] against zero or more other effects. Yields either the first success or the last failure.

Races an IO[E, A] against zero or more other effects. Yields either the first success or the last failure.

Attributes

def raceFirst[R, R1 <: R, E, A](zio: ZIO[R, E, A], ios: Iterable[ZIO[R1, E, A]])(implicit trace: Trace): ZIO[R1, E, A]

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

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

WARNING: The raced effect will safely interrupt the "losers", but will not resume until the losers have been cleanly terminated. If early return is desired, then instead of performing ZIO.raceFirst(l, rs), perform ZIO.raceFirst(l.disconnect, rs.map(_.disconnect)), which disconnects left and rights interrupt signal, allowing a fast return, with interruption performed in the background.

Attributes

def random(implicit trace: Trace): UIO[Random]

Retreives the Random service for this workflow.

Retreives the Random service for this workflow.

Attributes

def randomWith[R, E, A](f: Random => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]

Retrieves the Random service for this workflow and uses it to run the specified workflow.

Retrieves the Random service for this workflow and uses it to run the specified workflow.

Attributes

def reduceAll[R, R1 <: R, E, A](a: => ZIO[R, E, A], as: => Iterable[ZIO[R1, E, A]])(f: (A, A) => A)(implicit trace: Trace): ZIO[R1, E, A]

Reduces an Iterable[IO] to a single IO, working sequentially.

Reduces an Iterable[IO] to a single IO, working sequentially.

Attributes

def reduceAllPar[R, R1 <: R, E, A](a0: => ZIO[R, E, A], as0: => Iterable[ZIO[R1, E, A]])(f: (A, A) => A)(implicit trace: Trace): ZIO[R1, E, A]

Reduces an Iterable[IO] to a single IO, working in parallel.

Reduces an Iterable[IO] to a single IO, working in parallel.

Attributes

def refailCause[E](cause: Cause[E])(implicit trace: Trace): ZIO[Any, E, Nothing]
def replicate[R, E, A](n: Int)(effect: ZIO[R, E, A])(implicit trace: Trace): Iterable[ZIO[R, E, A]]

Replicates the given effect n times. If 0 or negative numbers are given, an empty Iterable will be returned. This method is more efficient than using List.fill or similar methods, because the returned Iterable consumes only a small amount of heap regardless of n.

Replicates the given effect n times. If 0 or negative numbers are given, an empty Iterable will be returned. This method is more efficient than using List.fill or similar methods, because the returned Iterable consumes only a small amount of heap regardless of n.

Attributes

def replicateZIO[R, E, A](n: => Int)(effect: => ZIO[R, E, A])(implicit trace: Trace): 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.

Attributes

def replicateZIODiscard[R, E, A](n: => Int)(effect: => ZIO[R, E, A])(implicit trace: Trace): 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.

Attributes

def right[B](b: => B)(implicit trace: Trace): UIO[Either[Nothing, B]]

Returns an effect with the value on the right part.

Returns an effect with the value on the right part.

Attributes

def runtime[R](implicit trace: Trace): URIO[R, Runtime[R]]

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.

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.

Attributes

def runtimeFlags(implicit trace: Trace): ZIO[Any, Nothing, RuntimeFlags]

Retrieves an effect that succeeds with the current runtime flags, which govern behavior and features of the runtime system.

Retrieves an effect that succeeds with the current runtime flags, which govern behavior and features of the runtime system.

Attributes

def scope(implicit trace: Trace): ZIO[Scope, Nothing, Scope]

Returns the current scope.

Returns the current scope.

Attributes

def scopeWith[R, E, A](f: Scope => ZIO[R, E, A])(implicit trace: Trace): ZIO[R & Scope, E, A]

Accesses the current scope and uses it to perform the specified effect.

Accesses the current scope and uses it to perform the specified effect.

Attributes

Scopes all resources used 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 used 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)
}

Attributes

def scopedWith[R, E, A](f: Scope => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]

Creates a scope, uses it to perform the specified effect, and closes the scope as soon as the effect completes, whether by success, failure, or interruption.

Creates a scope, uses it to perform the specified effect, and closes the scope as soon as the effect completes, whether by success, failure, or interruption.

Attributes

def sequentialFinalizers[R, E, A](zio: => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]

Returns a new scoped workflow that runs finalizers added to the scope of this workflow sequentially in the reverse of the order in which they were added. Note that finalizers are run sequentially by default so this only has meaning if used within a scope where finalizers are being run in parallel.

Returns a new scoped workflow that runs finalizers added to the scope of this workflow sequentially in the reverse of the order in which they were added. Note that finalizers are run sequentially by default so this only has meaning if used within a scope where finalizers are being run in parallel.

Attributes

def service[A : Tag](implicit evidence$117: Tag[A], trace: Trace): URIO[A, A]

Accesses the specified service in the environment of the effect.

Accesses the specified service in the environment of the effect.

Attributes

def serviceAt[Service]: ServiceAtPartiallyApplied[Service]

Accesses the service corresponding to the specified key in the environment.

Accesses the service corresponding to the specified key in the environment.

Attributes

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

Attributes

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

Attributes

def setFiberRefs(fiberRefs: => FiberRefs)(implicit trace: Trace): UIO[Unit]

Sets the FiberRef values for the fiber running this effect to the values in the specified collection of FiberRef values.

Sets the FiberRef values for the fiber running this effect to the values in the specified collection of FiberRef values.

Attributes

def setState[S : Tag](s: => S)(implicit evidence$116: Tag[S], trace: Trace): ZIO[ZState[S], Nothing, Unit]

Sets a state in the environment to the specified value.

Sets a state in the environment to the specified value.

Attributes

def shift(executor: => Executor)(implicit trace: Trace): UIO[Unit]

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.

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.

Attributes

def sleep(duration: => Duration)(implicit trace: Trace): UIO[Unit]

Returns an effect that suspends for the specified duration. This method is asynchronous, and does not actually block the fiber executing the effect.

Returns an effect that suspends for the specified duration. This method is asynchronous, and does not actually block the fiber executing the effect.

Attributes

def some[A](a: => A)(implicit trace: Trace): UIO[Option[A]]

Returns an effect with the optional value.

Returns an effect with the optional value.

Attributes

def stackTrace(implicit trace: Trace): UIO[StackTrace]

Capture ZIO stack trace at the current point.

Capture ZIO stack trace at the current point.

Attributes

Provides a stateful ZIO workflow with its initial state, resulting in a workflow that is ready to be run.

Provides a stateful ZIO workflow with its initial state, resulting in a workflow that is ready to be run.

ZIO.stateful(0) {
 for {
     _     <- ZIO.updateState[Int](_ + 1)
     state <- ZIO.getState[Int]
   } yield assertTrue(state == 1)
 }

Attributes

Provides a stateful ZIO workflow with its initial state, using the specified patch type to combine updates to the state by different fibers in a compositional way.

Provides a stateful ZIO workflow with its initial state, using the specified patch type to combine updates to the state by different fibers in a compositional way.

Attributes

def succeedBlockingUnsafe[A](a: Unsafe => A)(implicit trace: Trace): UIO[A]
def succeedUnsafe[A](a: Unsafe => A)(implicit trace: Trace): UIO[A]
def suspend[R, A](rio: => RIO[R, A])(implicit trace: Trace): RIO[R, A]

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

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

Attributes

def suspendSucceed[R, E, A](zio: => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]

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 ZIO.suspend.

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 ZIO.suspend.

Attributes

def suspendSucceedUnsafe[R, E, A](zio: Unsafe => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]
def system(implicit trace: Trace): UIO[System]

Retrieves the System service for this workflow.

Retrieves the System service for this workflow.

Attributes

def systemWith[R, E, A](f: System => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]

Retrieves the System service for this workflow and uses it to run the specified workflow.

Retrieves the System service for this workflow and uses it to run the specified workflow.

Attributes

def tagged(key: => String, value: => String): Tagged

Tags each metric in this effect with the specific tag.

Tags each metric in this effect with the specific tag.

Attributes

def tagged(tag: => MetricLabel, tags: MetricLabel*): Tagged

Tags each metric in this effect with the specific tag.

Tags each metric in this effect with the specific tag.

Attributes

def tagged(tags: => Set[MetricLabel]): Tagged

Tags each metric in this effect with the specific tag.

Tags each metric in this effect with the specific tag.

Attributes

def taggedScoped(key: => String, value: => String)(implicit trace: Trace): ZIO[Scope, Nothing, Unit]
def taggedScoped(tag: => MetricLabel, tags: MetricLabel*)(implicit trace: Trace): ZIO[Scope, Nothing, Unit]
def taggedScoped(tags: => Set[MetricLabel])(implicit trace: Trace): ZIO[Scope, Nothing, Unit]
def tags(implicit trace: Trace): ZIO[Any, Nothing, Set[MetricLabel]]

Retrieves the metric tags associated with the current scope.

Retrieves the metric tags associated with the current scope.

Attributes

def transplant[R, E, A](f: Grafter => ZIO[R, E, A])(implicit trace: Trace): 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.

Attributes

def uninterruptible[R, E, A](zio: => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]

Prefix form of ZIO#uninterruptible.

Prefix form of ZIO#uninterruptible.

Attributes

def uninterruptibleMask[R, E, A](f: InterruptibilityRestorer => ZIO[R, E, A])(implicit trace: Trace): 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.

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.

Attributes

def unless[R, E, A](p: => Boolean)(zio: => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, Option[A]]

The moral equivalent of if (!p) exp

The moral equivalent of if (!p) exp

Attributes

def unlessZIO[R, E](p: => ZIO[R, E, Boolean]): UnlessZIO[R, E]

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

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

Attributes

def unsandbox[R, E, A](v: => ZIO[R, Cause[E], A])(implicit trace: Trace): ZIO[R, E, A]

The inverse operation IO.sandboxed

The inverse operation IO.sandboxed

Terminates with exceptions on the Left side of the Either error, if it exists. Otherwise extracts the contained IO[E, A]

Attributes

def unshift(implicit trace: Trace): UIO[Unit]

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.

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.

Attributes

def updateFiberRefs(f: (Runtime, FiberRefs) => FiberRefs)(implicit trace: Trace): UIO[Unit]

Updates the FiberRef values for the fiber running this effect using the specified function.

Updates the FiberRef values for the fiber running this effect using the specified function.

Attributes

def updateRuntimeFlags(patch: Patch)(implicit trace: Trace): ZIO[Any, Nothing, Unit]

Updates the runtime flags. This may have a performance impact. For a higher-performance variant, see ZIO#withRuntimeFlags.

Updates the runtime flags. This may have a performance impact. For a higher-performance variant, see ZIO#withRuntimeFlags.

Attributes

def updateState[S : Tag](f: S => S)(implicit evidence$118: Tag[S], trace: Trace): ZIO[ZState[S], Nothing, Unit]

Updates a state in the environment with the specified function.

Updates a state in the environment with the specified function.

Attributes

Scopes all resources acquired by resource to the lifetime of use without effecting the scope of any resources acquired by use.

Scopes all resources acquired by resource to the lifetime of use without effecting the scope of any resources acquired by use.

Attributes

def validate[R, E, A, B, Collection <: (Iterable)](in: Collection[A])(f: A => ZIO[R, E, B])(implicit bf: BuildFrom[Collection[A], B, Collection[B]], ev: CanFail[E], trace: Trace): ZIO[R, ::[E], Collection[B]]

Feeds elements of type A to f and accumulates all errors in error channel or successes in success channel.

Feeds elements of type A to f 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.

Attributes

def validate[R, E, A, B](in: NonEmptyChunk[A])(f: A => ZIO[R, E, B])(implicit ev: CanFail[E], trace: Trace): ZIO[R, ::[E], NonEmptyChunk[B]]

Feeds elements of type A to f and accumulates all errors in error channel or successes in success channel.

Feeds elements of type A to f 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.

Attributes

def validateDiscard[R, E, A](in: => Iterable[A])(f: A => ZIO[R, E, Any])(implicit ev: CanFail[E], trace: Trace): ZIO[R, ::[E], Unit]

Feeds elements of type A to f and accumulates all errors, discarding the successes.

Feeds elements of type A to f and accumulates all errors, discarding the successes.

Attributes

def validateFirst[R, E, A, B, Collection <: (Iterable)](in: Collection[A])(f: A => ZIO[R, E, B])(implicit bf: BuildFrom[Collection[A], E, Collection[E]], ev: CanFail[E], trace: Trace): ZIO[R, Collection[E], B]

Feeds elements of type A to f until it succeeds. Returns first success or the accumulation of all errors.

Feeds elements of type A to f until it succeeds. Returns first success or the accumulation of all errors.

Attributes

def validateFirstPar[R, E, A, B, Collection <: (Iterable)](in: Collection[A])(f: A => ZIO[R, E, B])(implicit bf: BuildFrom[Collection[A], E, Collection[E]], ev: CanFail[E], trace: Trace): ZIO[R, Collection[E], B]

Feeds elements of type A to f, in parallel, until it succeeds. Returns first success or the accumulation of all errors.

Feeds elements of type A to f, in parallel, until it succeeds. Returns first success or the accumulation of all errors.

In case of success all other running fibers are terminated.

Attributes

def validatePar[R, E, A, B, Collection <: (Iterable)](in: Collection[A])(f: A => ZIO[R, E, B])(implicit bf: BuildFrom[Collection[A], B, Collection[B]], ev: CanFail[E], trace: Trace): ZIO[R, ::[E], Collection[B]]

Feeds elements of type A to fand accumulates, in parallel, all errors in error channel or successes in success channel.

Feeds elements of type A to fand 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.

Attributes

def validatePar[R, E, A, B](in: NonEmptyChunk[A])(f: A => ZIO[R, E, B])(implicit ev: CanFail[E], trace: Trace): ZIO[R, ::[E], NonEmptyChunk[B]]

Feeds elements of type A to fand accumulates, in parallel, all errors in error channel or successes in success channel.

Feeds elements of type A to fand 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.

Attributes

def validateParDiscard[R, E, A](in: => Iterable[A])(f: A => ZIO[R, E, Any])(implicit ev: CanFail[E], trace: Trace): ZIO[R, ::[E], Unit]

Feeds elements of type A to f in parallel and accumulates all errors, discarding the successes.

Feeds elements of type A to f in parallel and accumulates all errors, discarding the successes.

Attributes

def when[R, E, A](p: => Boolean)(zio: => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, Option[A]]

The moral equivalent of if (p) exp

The moral equivalent of if (p) exp

Attributes

def whenCase[R, E, A, B](a: => A)(pf: PartialFunction[A, ZIO[R, E, B]])(implicit trace: Trace): ZIO[R, E, Option[B]]

Runs an effect when the supplied PartialFunction matches for the given value, otherwise does nothing.

Runs an effect when the supplied PartialFunction matches for the given value, otherwise does nothing.

Attributes

def whenCaseZIO[R, E, A, B](a: => ZIO[R, E, A])(pf: PartialFunction[A, ZIO[R, E, B]])(implicit trace: Trace): 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.

Attributes

def whenZIO[R, E](p: => ZIO[R, E, Boolean]): WhenZIO[R, E]

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

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

Attributes

def whileLoop[R, E, A](check: => Boolean)(body: => ZIO[R, E, A])(process: A => Any)(implicit trace: Trace): ZIO[R, E, Unit]

A low-level while-loop with direct support in the ZIO runtime. The only reason to use this constructor is performance.

A low-level while-loop with direct support in the ZIO runtime. The only reason to use this constructor is performance.

See ZIO.iterate for a user-friendly version of this operator that is compatible with purely functional code.

Attributes

def withChildren[R, E, A](get: UIO[Chunk[Runtime[Any, Any]]] => ZIO[R, E, A])(implicit trace: Trace): 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.

Locally installs a supervisor and an effect that succeeds with all the children that have been forked in the returned effect.

Attributes

def withClock[R, E, A <: Clock, B](clock: => A)(zio: => ZIO[R, E, B])(implicit tag: Tag[A], trace: Trace): ZIO[R, E, B]

Executes the specified workflow with the specified implementation of the clock service.

Executes the specified workflow with the specified implementation of the clock service.

Attributes

def withClockScoped[A <: Clock](clock: => A)(implicit tag: Tag[A], trace: Trace): ZIO[Scope, Nothing, Unit]

Sets the implementation of the clock service to the specified value and restores it to its original value when the scope is closed.

Sets the implementation of the clock service to the specified value and restores it to its original value when the scope is closed.

Attributes

def withConfigProvider[R, E, A <: ConfigProvider, B](configProvider: => A)(zio: => ZIO[R, E, B])(implicit tag: Tag[A], trace: Trace): ZIO[R, E, B]

Executes the specified workflow with the specified configuration provider.

Executes the specified workflow with the specified configuration provider.

Attributes

def withConfigProviderScoped[A <: ConfigProvider](configProvider: => A)(implicit tag: Tag[A], trace: Trace): ZIO[Scope, Nothing, Unit]

Sets the configuration provider to the specified value and restores it to its original value when the scope is closed.

Sets the configuration provider to the specified value and restores it to its original value when the scope is closed.

Attributes

def withConsole[R, E, A <: Console, B](console: => A)(zio: => ZIO[R, E, B])(implicit tag: Tag[A], trace: Trace): ZIO[R, E, B]

Executes the specified workflow with the specified implementation of the console service.

Executes the specified workflow with the specified implementation of the console service.

Attributes

def withConsoleScoped[A <: Console](console: => A)(implicit tag: Tag[A], trace: Trace): ZIO[Scope, Nothing, Unit]

Sets the implementation of the console service to the specified value and restores it to its original value when the scope is closed.

Sets the implementation of the console service to the specified value and restores it to its original value when the scope is closed.

Attributes

def withLogger[R, E, A <: ZLogger[String, Any], B](logger: => A)(zio: => ZIO[R, E, B])(implicit tag: Tag[A], trace: Trace): ZIO[R, E, B]

Executed this workflow with the specified logger added.

Executed this workflow with the specified logger added.

Attributes

def withLoggerScoped[A <: ZLogger[String, Any]](logger: => A)(implicit tag: Tag[A], trace: Trace): ZIO[Scope, Nothing, Unit]

Adds the specified logger and removes it when the scope is closed.

Adds the specified logger and removes it when the scope is closed.

Attributes

def withParallelism[R, E, A](n: => Int)(zio: ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]

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

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

Attributes

def withParallelismMask[R, E, A](n: => Int)(f: ParallelismRestorer => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]

Runs the specified effect with the specified maximum number of fibers for parallel operators, but passes it a restore function that can be used to restore the inherited parallelism from whatever region the effect is composed into.

Runs the specified effect with the specified maximum number of fibers for parallel operators, but passes it a restore function that can be used to restore the inherited parallelism from whatever region the effect is composed into.

Attributes

def withParallelismUnbounded[R, E, A](zio: ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]

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

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

Attributes

def withParallelismUnboundedMask[R, E, A](f: ParallelismRestorer => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]

Runs the specified effect with an unbounded maximum number of fibers for parallel operators, but passes it a restore function that can be used to restore the inherited parallelism from whatever region the effect is composed into.

Runs the specified effect with an unbounded maximum number of fibers for parallel operators, but passes it a restore function that can be used to restore the inherited parallelism from whatever region the effect is composed into.

Attributes

def withRandom[R, E, A <: Random, B](random: => A)(zio: => ZIO[R, E, B])(implicit tag: Tag[A], trace: Trace): ZIO[R, E, B]

Executes the specified workflow with the specified implementation of the random service.

Executes the specified workflow with the specified implementation of the random service.

Attributes

def withRandomScoped[A <: Random](random: => A)(implicit tag: Tag[A], trace: Trace): ZIO[Scope, Nothing, Unit]

Sets the implementation of the random service to the specified value and restores it to its original value when the scope is closed.

Sets the implementation of the random service to the specified value and restores it to its original value when the scope is closed.

Attributes

def withRuntimeFlagsScoped(update: Patch)(implicit trace: Trace): ZIO[Scope, Nothing, Unit]
def withSystem[R, E, A <: System, B](system: => A)(zio: => ZIO[R, E, B])(implicit tag: Tag[A], trace: Trace): ZIO[R, E, B]

Executes the specified workflow with the specified implementation of the system service.

Executes the specified workflow with the specified implementation of the system service.

Attributes

def withSystemScoped[A <: System](system: => A)(implicit tag: Tag[A], trace: Trace): ZIO[Scope, Nothing, Unit]

Sets the implementation of the system service to the specified value and restores it to its original value when the scope is closed.

Sets the implementation of the system service to the specified value and restores it to its original value when the scope is closed.

Attributes

def yieldNow(implicit trace: Trace): UIO[Unit]

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.

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.

Attributes

Inherited methods

def async[R, E, A](register: Unsafe ?=> (ZIO[R, E, A] => Unit) => Unit, blockingOn: => FiberId)(implicit trace: Trace): ZIO[R, E, A]

Converts an asynchronous, callback-style API into a ZIO effect, which will be executed asynchronously.

Converts an asynchronous, callback-style API into a ZIO effect, which will be executed asynchronously.

This method allows you to specify the fiber id that is responsible for invoking callbacks provided to the register function. This is called the "blocking fiber", because it is stopping the fiber executing the async effect from making progress (although it is not "blocking" a thread). Specifying this fiber id in cases where it is known will improve diagnostics, but not affect the behavior of the returned effect.

Attributes

Inherited from:
ZIOCompanionVersionSpecific
def asyncInterrupt[R, E, A](register: Unsafe ?=> (ZIO[R, E, A] => Unit) => Either[URIO[R, Any], ZIO[R, E, A]], blockingOn: => FiberId)(implicit trace: Trace): ZIO[R, E, A]

Converts an asynchronous, callback-style API into a ZIO effect, which will be executed asynchronously.

Converts an asynchronous, callback-style API into a ZIO effect, which will be executed asynchronously.

With this variant, you can specify either a way to cancel the asynchrounous action, or you can return the result right away if no asynchronous operation is required.

This method allows you to specify the fiber id that is responsible for invoking callbacks provided to the register function. This is called the "blocking fiber", because it is stopping the fiber executing the async effect from making progress (although it is not "blocking" a thread). Specifying this fiber id in cases where it is known will improve diagnostics, but not affect the behavior of the returned effect.

Attributes

Inherited from:
ZIOCompanionVersionSpecific
def asyncMaybe[R, E, A](register: Unsafe ?=> (ZIO[R, E, A] => Unit) => Option[ZIO[R, E, A]], blockingOn: => FiberId)(implicit trace: Trace): ZIO[R, E, A]

Converts an asynchronous, callback-style API into a ZIO effect, which will be executed asynchronously.

Converts an asynchronous, callback-style API into a ZIO effect, which will be executed asynchronously.

With this variant, the registration function may return the result right away, if it turns out that no asynchronous operation is required to complete the operation.

This method allows you to specify the fiber id that is responsible for invoking callbacks provided to the register function. This is called the "blocking fiber", because it is stopping the fiber executing the async effect from making progress (although it is not "blocking" a thread). Specifying this fiber id in cases where it is known will improve diagnostics, but not affect the behavior of the returned effect.

Attributes

Inherited from:
ZIOCompanionVersionSpecific
def asyncWithCompletionHandler[T](op: CompletionHandler[T, Any] => Any)(implicit trace: Trace): Task[T]

Attributes

Inherited from:
ZIOCompanionPlatformSpecific (hidden)
def attempt[A](code: Unsafe ?=> A)(implicit trace: Trace): Task[A]

Returns an effect that, when executed, will cautiously run the provided code, catching any exception and translated it into a failed ZIO effect.

Returns an effect that, when executed, will cautiously run the provided code, catching any exception and translated it into a failed ZIO effect.

This method should be used whenever you want to take arbitrary code, which may throw exceptions or not be type safe, and convert it into a ZIO effect, which can safely execute that code whenever the effect is executed.

def printLine(line: String): Task[Unit] = ZIO.attempt(println(line))

Attributes

Inherited from:
ZIOCompanionVersionSpecific
def attemptBlocking[A](effect: Unsafe ?=> A)(implicit trace: Trace): Task[A]

Returns an effect that, when executed, will cautiously run the provided code, catching any exception and translated it into a failed ZIO effect.

Returns an effect that, when executed, will cautiously run the provided code, catching any exception and translated it into a failed ZIO effect.

This method should be used whenever you want to take arbitrary code, which may throw exceptions or not be type safe, and convert it into a ZIO effect, which can safely execute that code whenever the effect is executed.

This variant expects that the provided code will engage in blocking I/O, and therefore, pro-actively executes the code on a dedicated blocking thread pool, so it won't interfere with the main thread pool that ZIO uses.

Attributes

Inherited from:
ZIOCompanionVersionSpecific
def attemptBlockingCancelable[R, A](effect: => A)(cancel: => URIO[R, Any])(implicit trace: Trace): RIO[R, A]

Returns an effect that, when executed, will cautiously run the provided code, catching any exception and translated it into a failed ZIO effect.

Returns an effect that, when executed, will cautiously run the provided code, catching any exception and translated it into a failed ZIO effect.

This method should be used whenever you want to take arbitrary code, which may throw exceptions or not be type safe, and convert it into a ZIO effect, which can safely execute that code whenever the effect is executed.

This variant expects that the provided code will engage in blocking I/O, and therefore, pro-actively executes the code on a dedicated blocking thread pool, so it won't interfere with the main thread pool that ZIO uses.

Additionally, this variant allows you to specify an effect that will cancel the blocking operation. This effect will be executed if the fiber that is executing the blocking effect is interrupted for any reason.

Attributes

Inherited from:
ZIOCompanionVersionSpecific
def attemptBlockingIO[A](effect: Unsafe ?=> A)(implicit trace: Trace): IO[IOException, A]

This function is the same as attempt, except that it only exposes IOException, treating any other exception as fatal.

This function is the same as attempt, except that it only exposes IOException, treating any other exception as fatal.

Attributes

Inherited from:
ZIOCompanionVersionSpecific
def attemptBlockingInterrupt[A](effect: => A)(implicit trace: Trace): 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 via Thread.interrupt.

Note that this adds significant overhead. For performance sensitive applications consider using attemptBlocking or attemptBlockingCancelable.

Attributes

Inherited from:
ZIOCompanionPlatformSpecific (hidden)
def fromCompletableFuture[A](cs: => CompletableFuture[A])(implicit trace: Trace): Task[A]

Alias for formCompletionStage for a concrete implementation of CompletionStage

Alias for formCompletionStage for a concrete implementation of CompletionStage

Attributes

Inherited from:
ZIOCompanionPlatformSpecific (hidden)
def fromCompletionStage[A](cs: => CompletionStage[A])(implicit trace: Trace): Task[A]

Attributes

Inherited from:
ZIOCompanionPlatformSpecific (hidden)
def fromFutureJava[A](future: => Future[A])(implicit trace: Trace): Task[A]

WARNING: this uses the blocking Future#get, consider using fromCompletionStage

WARNING: this uses the blocking Future#get, consider using fromCompletionStage

Attributes

Inherited from:
ZIOCompanionPlatformSpecific (hidden)
def ignore(code: Unsafe ?=> Any)(implicit trace: Trace): UIO[Unit]

Returns an effect that, when executed, will cautiously run the provided code, ignoring it success or failure.

Returns an effect that, when executed, will cautiously run the provided code, ignoring it success or failure.

Attributes

Inherited from:
ZIOCompanionVersionSpecific
def readFile(name: => String)(implicit trace: Trace): ZIO[Any, IOException, String]

Attributes

Inherited from:
ZIOCompanionPlatformSpecific (hidden)
def readFile(path: => Path)(implicit trace: Trace, d: DummyImplicit): ZIO[Any, IOException, String]

Attributes

Inherited from:
ZIOCompanionPlatformSpecific (hidden)
def readFileInputStream(name: => String)(implicit trace: Trace): ZIO[Scope, IOException, ZInputStream]

Attributes

Inherited from:
ZIOCompanionPlatformSpecific (hidden)
def readFileInputStream(path: => Path)(implicit trace: Trace, d: DummyImplicit): ZIO[Scope, IOException, ZInputStream]

Attributes

Inherited from:
ZIOCompanionPlatformSpecific (hidden)
def readURIInputStream(uri: => URI)(implicit trace: Trace): ZIO[Scope, IOException, ZInputStream]

Attributes

Inherited from:
ZIOCompanionPlatformSpecific (hidden)
def readURLInputStream(url: => String)(implicit trace: Trace): ZIO[Scope, IOException, ZInputStream]

Attributes

Inherited from:
ZIOCompanionPlatformSpecific (hidden)
def readURLInputStream(url: => URL)(implicit trace: Trace, d: DummyImplicit): ZIO[Scope, IOException, ZInputStream]

Attributes

Inherited from:
ZIOCompanionPlatformSpecific (hidden)
def succeed[A](a: Unsafe ?=> A)(implicit trace: Trace): ZIO[Any, Nothing, A]

Returns an effect that models success with the specified value.

Returns an effect that models success with the specified value.

Attributes

Inherited from:
ZIOCompanionVersionSpecific
def succeedBlocking[A](a: Unsafe ?=> A)(implicit trace: Trace): UIO[A]

Returns a synchronous effect that does blocking and succeeds with the specified value.

Returns a synchronous effect that does blocking and succeeds with the specified value.

Attributes

Inherited from:
ZIOCompanionVersionSpecific
def writeFile(path: => Path, content: => String)(implicit trace: Trace, d: DummyImplicit): ZIO[Any, IOException, Unit]

Attributes

Inherited from:
ZIOCompanionPlatformSpecific (hidden)
def writeFile(path: => String, content: => String)(implicit trace: Trace): ZIO[Any, IOException, Unit]

Attributes

Inherited from:
ZIOCompanionPlatformSpecific (hidden)

Attributes

Inherited from:
ZIOCompanionPlatformSpecific (hidden)
def writeFileOutputStream(path: => String)(implicit trace: Trace): ZIO[Scope, IOException, ZOutputStream]

Attributes

Inherited from:
ZIOCompanionPlatformSpecific (hidden)

Concrete fields

final lazy val Parallelism: FiberRef[Option[Int]]

The level of parallelism for parallel operators.

The level of parallelism for parallel operators.

Attributes

val none: UIO[Option[Nothing]]

Returns an effect that succeeds with the None value.

Returns an effect that succeeds with the None value.

Attributes

val unit: UIO[Unit]

An effect that succeeds with a unit value.

An effect that succeeds with a unit value.

Attributes

Implicits

Implicits

final implicit def ZIOAutoCloseableOps[R, E, A <: AutoCloseable](io: ZIO[R, E, A]): ZIOAutoCloseableOps[R, E, A]
final implicit def ZIOBooleanOps[R, E](self: ZIO[R, E, Boolean]): ZIOBooleanOps[R, E]
final implicit def ZioRefineToOrDieOps[R, E <: Throwable, A](self: ZIO[R, E, A]): ZioRefineToOrDieOps[R, E, A]