trait ZIOFunctions extends Serializable
- Alphabetic
- By Inheritance
- ZIOFunctions
- Serializable
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def absolve[R >: LowerR, E <: UpperE, A](v: ZIO[R, E, Either[E, A]]): ZIO[R, E, A]
Submerges the error case of an
Eitherinto theZIO.Submerges the error case of an
Eitherinto theZIO. The inverse operation ofIO.either. - final def access[R >: LowerR, A](f: (R) ⇒ A): ZIO[R, Nothing, A]
Accesses the environment of the effect.
Accesses the environment of the effect.
val portNumber = effect.access(_.config.portNumber) - final def accessM[R >: LowerR, E <: UpperE, A](f: (R) ⇒ ZIO[R, E, A]): ZIO[R, E, A]
Effectfully accesses the environment of the effect.
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- final def bracket[R >: LowerR, E <: UpperE, A](acquire: ZIO[R, E, A]): BracketAcquire[R, E, A]
When this effect represents acquisition of a resource (for example, opening a file, launching a thread, etc.),
bracketcan be used to ensure the acquisition is not interrupted and the resource is always released.When this effect represents acquisition of a resource (for example, opening a file, launching a thread, etc.),
bracketcan be used to ensure the acquisition is not interrupted and the resource is always released.The function does two things:
1. Ensures this effect, which acquires the resource, will not be interrupted. Of course, acquisition may fail for internal reasons (an uncaught exception). 2. Ensures the
releaseeffect 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
useeffect is executed.If the
releaseeffect fails, then the entire effect will fail even if theuseeffect succeeds. If this fail-fast behavior is not desired, errors produced by thereleaseeffect can be caught and ignored.openFile("data.json").bracket(closeFile) { file => for { header <- readHeader(file) ... } yield result }
- final def bracketExit[R >: LowerR, E <: UpperE, A](acquire: ZIO[R, E, A]): BracketExitAcquire[R, E, A]
Acquires a resource, uses the resource, and then releases the resource.
Acquires a resource, uses the resource, and then releases the resource. Neither the acquisition nor the release will be interrupted, and the resource is guaranteed to be released, so long as the
acquireeffect succeeds. Ifusefails, then after release, the returned effect will fail with the same error. - def clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws(classOf[java.lang.CloneNotSupportedException])
- final def collectAll[R >: LowerR, E <: UpperE, A](in: Iterable[ZIO[R, E, A]]): ZIO[R, E, List[A]]
Evaluate each effect in the structure from left to right, and collect the results.
Evaluate each effect in the structure from left to right, and collect the results. For a parallel version, see
collectAllPar. - final def collectAllPar[R >: LowerR, E <: UpperE, A](as: Iterable[ZIO[R, E, A]]): ZIO[R, E, List[A]]
Evaluate each effect in the structure in parallel, and collect the results.
Evaluate each effect in the structure in parallel, and collect the results. For a sequential version, see
collectAll. - final def collectAllParN[R >: LowerR, E <: UpperE, A](n: Long)(as: Iterable[ZIO[R, E, A]]): ZIO[R, E, List[A]]
Evaluate each effect in the structure in parallel, and collect the results.
Evaluate each effect in the structure in parallel, and collect the results. For a sequential version, see
collectAll.Unlike
foreachAllPar, this method will use at mostnfibers. - final def descriptor: UIO[Descriptor]
Returns information about the current fiber, such as its fiber identity.
- final def die(t: Throwable): UIO[Nothing]
Returns an effect that dies with the specified
Throwable.Returns an effect that dies with the specified
Throwable. This method can be used for terminating a fiber because a defect has been detected in the code. - final def dieMessage(message: String): UIO[Nothing]
Returns an effect that dies with a java.lang.RuntimeException having the specified text message.
Returns an effect that dies with a java.lang.RuntimeException having the specified text message. This method can be used for terminating a fiber because a defect has been detected in the code.
- final def done[E <: UpperE, A](r: Exit[E, A]): IO[E, A]
Returns an effect from a scalaz.zio.Exit value.
- final def effectAsync[E <: UpperE, A](register: ((ZIO[Any, E, A]) ⇒ Unit) ⇒ Unit): ZIO[Any, E, A]
Imports an asynchronous effect into a pure
ZIOvalue.Imports an asynchronous effect into a pure
ZIOvalue. SeeeffectAsyncMaybefor the more expressive variant of this function that can return a value synchronously. - final def effectAsyncInterrupt[R >: LowerR, E <: UpperE, A](register: ((ZIO[R, E, A]) ⇒ Unit) ⇒ Either[Canceler, ZIO[R, E, A]]): ZIO[R, E, A]
Imports an asynchronous effect into a pure
IOvalue.Imports an asynchronous effect into a pure
IOvalue. The effect has the option of returning the value synchronously, which is useful in cases where it cannot be determined if the effect is synchronous or asynchronous until the effect is actually executed. The effect also has the option of returning a canceler, which will be used by the runtime to cancel the asynchronous effect if the fiber executing the effect is interrupted. - final def effectAsyncM[E <: UpperE, A](register: ((IO[E, A]) ⇒ Unit) ⇒ UIO[_]): IO[E, A]
Imports an asynchronous effect into a pure
ZIOvalue.Imports an asynchronous effect into a pure
ZIOvalue. This formulation is necessary when the effect is itself expressed in terms ofZIO. - final def effectAsyncMaybe[E <: UpperE, A](register: ((ZIO[Any, E, A]) ⇒ Unit) ⇒ Option[IO[E, A]]): ZIO[Any, E, A]
Imports an asynchronous effect into a pure
ZIOvalue, possibly returning the value synchronously. - final def effectTotal[A](effect: ⇒ A): UIO[A]
Imports a total synchronous effect into a pure
ZIOvalue.Imports a total synchronous effect into a pure
ZIOvalue. The effect must not throw any exceptions. If you wonder if the effect throws exceptions, then do not use this method, use Task.effect, IO.effect, or ZIO.effect.val nanoTime: UIO[Long] = IO.effectTotal(System.nanoTime())
- final def effectTotalWith[A](effect: (Platform) ⇒ A): UIO[A]
Imports a total synchronous effect into a pure
ZIOvalue.Imports a total synchronous effect into a pure
ZIOvalue. This variant ofeffectTotallets the impure code use the platform capabilities.The effect must not throw any exceptions. If you wonder if the effect throws exceptions, then do not use this method, use Task.effect, IO.effect, or ZIO.effect.
val nanoTime: UIO[Long] = IO.effectTotal(System.nanoTime())
- final def environment[R >: LowerR]: ZIO[R, Nothing, R]
Accesses the whole environment of the effect.
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def fail[E <: UpperE](error: E): IO[E, Nothing]
Returns an effect that models failure with the specified error.
Returns an effect that models failure with the specified error. The moral equivalent of
throwfor pure code. - def finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def flatten[R >: LowerR, E <: UpperE, A](zio: ZIO[R, E, ZIO[R, E, A]]): 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.
- final def foldLeft[R >: LowerR, E, S, A](in: Iterable[A])(zero: S)(f: (S, A) ⇒ ZIO[R, E, S]): ZIO[R, E, S]
Folds an
Iterable[A]using an effectful functionf, working sequentially. - final def foreach[R >: LowerR, E <: UpperE, A, B](in: Iterable[A])(f: (A) ⇒ ZIO[R, E, B]): ZIO[R, E, List[B]]
Applies the function
fto each element of theIterable[A]and returns the results in a newList[B].Applies the function
fto each element of theIterable[A]and returns the results in a newList[B].For a parallel version of this method, see
foreachPar. - final def foreachPar[R >: LowerR, E <: UpperE, A, B](as: Iterable[A])(fn: (A) ⇒ ZIO[R, E, B]): ZIO[R, E, List[B]]
Applies the function
fto each element of theIterable[A]in parallel, and returns the results in a newList[B].Applies the function
fto each element of theIterable[A]in parallel, and returns the results in a newList[B].For a sequential version of this method, see
foreach. - final def foreachParN[R >: LowerR, E <: UpperE, A, B](n: Long)(as: Iterable[A])(fn: (A) ⇒ ZIO[R, E, B]): ZIO[R, E, List[B]]
Applies the function
fto each element of theIterable[A]in parallel, and returns the results in a newList[B].Applies the function
fto each element of theIterable[A]in parallel, and returns the results in a newList[B].Unlike
foreachPar, this method will use at most up tonfibers. - final def forkAll[R >: LowerR, E <: UpperE, A](as: Iterable[ZIO[R, E, A]]): ZIO[R, Nothing, Fiber[E, List[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.
- final def forkAll_[R >: LowerR, E <: UpperE, A](as: Iterable[ZIO[R, E, A]]): ZIO[R, Nothing, Unit]
Returns an effect that forks all of the specified values, and returns a composite fiber that produces unit.
Returns an effect that forks all of the specified values, and returns a composite fiber that produces unit. This version is faster than forkAll in cases where the results of the forked fibers are not needed.
- final def fromEither[E <: UpperE, A](v: ⇒ Either[E, A]): IO[E, A]
Lifts an
Eitherinto aZIOvalue. - final def fromFiber[E <: UpperE, A](fiber: ⇒ Fiber[E, A]): IO[E, A]
Creates a
ZIOvalue that represents the exit value of the specified fiber. - final def fromFiberM[E <: UpperE, A](fiber: IO[E, Fiber[E, A]]): IO[E, A]
Creates a
ZIOvalue that represents the exit value of the specified fiber. - final def fromFunction[R >: LowerR, A](f: (R) ⇒ A): ZIO[R, Nothing, A]
Lifts a function
R => Ainto aZIO[R, Nothing, A]. - final def fromFunctionM[R >: LowerR, E, A](f: (R) ⇒ IO[E, A]): ZIO[R, E, A]
Lifts an effectful function whose effect requires no environment into an effect that requires the input to the function.
- final def getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def halt[E <: UpperE](cause: Cause[E]): IO[E, Nothing]
Returns an effect that models failure with the specified
Cause. - def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final val interrupt: UIO[Nothing]
Returns an effect that is interrupted.
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def lock[R >: LowerR, E <: UpperE, A](executor: Executor)(zio: ZIO[R, E, A]): ZIO[R, E, A]
Returns an effect that will execute the specified effect fully on the provided executor, before returning to the default executor.
- final def mergeAll[R >: LowerR, E <: UpperE, A, B](in: Iterable[ZIO[R, E, A]])(zero: B)(f: (B, A) ⇒ B): ZIO[R, E, B]
Merges an
Iterable[IO]to a single IO, working sequentially. - final def mergeAllPar[R >: LowerR, E <: UpperE, A, B](in: Iterable[ZIO[R, E, A]])(zero: B)(f: (B, A) ⇒ B): ZIO[R, E, B]
Merges an
Iterable[IO]to a single IO, working in parallel. - final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final val never: UIO[Nothing]
Returns a effect that will never produce anything.
Returns a effect that will never produce anything. The moral equivalent of
while(true) {}, only without the wasted CPU cycles. - final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def provide[R >: LowerR, E <: UpperE, A](r: R): (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
providefunction can be thought of asinject. - final def raceAll[R >: LowerR, R1 >: LowerR <: R, E <: UpperE, A](zio: ZIO[R, E, A], ios: Iterable[ZIO[R1, E, A]]): ZIO[R1, E, A]
Races an
IO[E, A]against zero or more other effects.Races an
IO[E, A]against zero or more other effects. Yields either the first success or the last failure. - final def reduceAll[R >: LowerR, R1 >: LowerR <: R, E <: UpperE, A](a: ZIO[R, E, A], as: Iterable[ZIO[R1, E, A]])(f: (A, A) ⇒ A): ZIO[R1, E, A]
Reduces an
Iterable[IO]to a singleIO, working sequentially. - final def reduceAllPar[R >: LowerR, R1 >: LowerR <: R, E <: UpperE, A](a: ZIO[R, E, A], as: Iterable[ZIO[R1, E, A]])(f: (A, A) ⇒ A): ZIO[R1, E, A]
Reduces an
Iterable[IO]to a singleIO, working in parallel. - final def require[E <: UpperE, A](error: E): (IO[E, Option[A]]) ⇒ IO[E, A]
Requires that the given
IO[E, Option[A]]contain a value.Requires that the given
IO[E, Option[A]]contain a value. If there is no value, then the specified error will be raised. - final def runtime[R >: LowerR]: ZIO[R, Nothing, Runtime[R]]
Returns an effect that accesses the runtime, which can be used to (unsafely) execute tasks.
Returns an effect that accesses the runtime, which can be used to (unsafely) execute tasks. This is useful for integration with non-functional code that must call back into functional code.
- final def succeed[A](a: A): UIO[A]
Returns an effect that models success with the specified strictly- evaluated value.
- final def succeedLazy[A](a: ⇒ A): UIO[A]
Returns an effect that models success with the specified lazily-evaluated value.
Returns an effect that models success with the specified lazily-evaluated value. This method should not be used to capture effects. See
IO.effectTotalfor capturing total effects, andIO.effectfor capturing partial effects. - final def supervise[R >: LowerR, E <: UpperE, A](zio: ZIO[R, E, A]): ZIO[R, E, A]
Returns an effect that supervises the specified effect, ensuring that all fibers that it forks are interrupted as soon as the supervised effect completes.
- final def superviseWith[R >: LowerR, E <: UpperE, A](zio: ZIO[R, E, A])(supervisor: (Iterable[Fiber[_, _]]) ⇒ UIO[_]): ZIO[R, E, A]
Returns an effect that supervises the specified effect, ensuring that all fibers that it forks are passed to the specified supervisor as soon as the supervised effect completes.
- final def suspend[R >: LowerR, E <: UpperE, A](io: ⇒ ZIO[R, E, A]): ZIO[R, E, A]
Returns a lazily constructed effect, whose construction may itself require effects.
Returns a lazily constructed effect, whose construction may itself require effects. This is a shortcut for
flatten(effectTotal(io)). - final def synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def unit[R >: LowerR]: ZIO[R, Nothing, Unit]
Strictly-evaluated unit lifted into the
ZIOmonad. - final def unsandbox[R >: LowerR, E <: UpperE, A](v: ZIO[R, Cause[E], A]): ZIO[R, E, A]
The inverse operation
IO.sandboxedThe inverse operation
IO.sandboxedTerminates with exceptions on the
Leftside of theEithererror, if it exists. Otherwise extracts the containedIO[E, A] - final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws(classOf[java.lang.InterruptedException])
- final def when[R >: LowerR, E <: UpperE](b: Boolean)(zio: ZIO[R, E, _]): ZIO[R, E, Unit]
The moral equivalent of
if (p) exp - final def whenM[R >: LowerR, E <: UpperE](b: ZIO[R, E, Boolean])(zio: ZIO[R, E, _]): ZIO[R, E, Unit]
The moral equivalent of
if (p) expwhenphas side-effects - final val yieldNow: UIO[Unit]
Returns an effect that yields to the runtime system, starting on a fresh stack.
Returns an effect that yields to the runtime system, starting on a fresh stack. Manual use of this method can improve fairness, at the cost of overhead.