zio

package zio

Members list

Packages

package zio.internal
package zio.metrics
package zio.stm

Type members

Classlikes

abstract class =!=[A, B] extends Serializable

Evidence type A is not equal to type B.

Evidence type A is not equal to type B.

Attributes

Companion
object
Supertypes
trait Serializable
class Object
trait Matchable
class Any
object =!=

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
=!=.type
case object BuildInfo

This object was generated by sbt-buildinfo.

This object was generated by sbt-buildinfo.

Attributes

Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Self type
BuildInfo.type
trait Cached[+Error, +Resource]

A Cached is a possibly resourceful value that is loaded into memory, and which can be refreshed either manually or automatically.

A Cached is a possibly resourceful value that is loaded into memory, and which can be refreshed either manually or automatically.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object Cached

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Cached.type
sealed abstract class CanFail[-E]

A value of type CanFail[E] provides implicit evidence that an effect with error type E can fail, that is, that E is not equal to Nothing.

A value of type CanFail[E] provides implicit evidence that an effect with error type E can fail, that is, that E is not equal to Nothing.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object CanFail.type
object CanFail extends CanFail[Any]

Attributes

Companion
class
Supertypes
trait Sum
trait Mirror
class CanFail[Any]
class Object
trait Matchable
class Any
Show all
Self type
CanFail.type
abstract class CancelableFuture[+A](val future: Future[A]) extends Future[A]

Attributes

Supertypes
trait Future[A]
trait Awaitable[A]
class Object
trait Matchable
class Any
sealed abstract class Cause[+E] extends Product, Serializable

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Known subtypes
class Both[E]
class Die
object Empty.type
class Fail[E]
class Interrupt
class Stackless[E]
class Then[E]
Show all
Self type
Cause[E]
object Cause extends Serializable

Attributes

Companion
class
Supertypes
trait Sum
trait Mirror
trait Serializable
class Object
trait Matchable
class Any
Show all
Self type
Cause.type
sealed abstract class Chunk[+A] extends ChunkLike[A], Serializable

A Chunk[A] represents a chunk of values of type A. Chunks are designed are usually backed by arrays, but expose a purely functional, safe interface to the underlying elements, and they become lazy on operations that would be costly with arrays, such as repeated concatenation.

A Chunk[A] represents a chunk of values of type A. Chunks are designed are usually backed by arrays, but expose a purely functional, safe interface to the underlying elements, and they become lazy on operations that would be costly with arrays, such as repeated concatenation.

The implementation of balanced concatenation is based on the one for Conc-Trees in "Conc-Trees for Functional and Parallel Programming" by Aleksandar Prokopec and Martin Odersky. http://aleksandar-prokopec.com/resources/docs/lcpc-conc-trees.pdf

NOTE: For performance reasons Chunk does not box primitive types. As a result, it is not safe to construct chunks from heterogeneous primitive types.

Attributes

Companion
object
Supertypes
trait Serializable
trait ChunkLike[A]
trait IndexedSeq[A]
trait IndexedSeqOps[A, Chunk, Chunk[A]]
trait IndexedSeq[A]
trait IndexedSeqOps[A, Chunk, Chunk[A]]
trait Seq[A]
trait SeqOps[A, Chunk, Chunk[A]]
trait Seq[A]
trait Equals
trait SeqOps[A, Chunk, Chunk[A]]
trait PartialFunction[Int, A]
trait Int => A
trait Iterable[A]
trait Iterable[A]
trait IterableOps[A, Chunk, Chunk[A]]
trait IterableOnceOps[A, Chunk, Chunk[A]]
trait IterableOnce[A]
class Object
trait Matchable
class Any
Show all
Self type
Chunk[A]
object Chunk

Attributes

Companion
class
Supertypes
trait SeqFactory[Chunk]
trait Serializable
class Object
trait Matchable
class Any
Show all
Self type
Chunk.type
sealed abstract class ChunkBuilder[A] extends Builder[A, Chunk[A]]

A ChunkBuilder[A] can build a Chunk[A] given elements of type A. ChunkBuilder is a mutable data structure that is implemented to efficiently build chunks of unboxed primitives and for compatibility with the Scala collection library.

A ChunkBuilder[A] can build a Chunk[A] given elements of type A. ChunkBuilder is a mutable data structure that is implemented to efficiently build chunks of unboxed primitives and for compatibility with the Scala collection library.

Attributes

Companion
object
Supertypes
trait Builder[A, Chunk[A]]
trait Growable[A]
trait Clearable
class Object
trait Matchable
class Any
Show all
Known subtypes
class Boolean
class Byte
class Char
class Double
class Float
class Int
class Long
class Short
Show all
object ChunkBuilder

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type

ChunkLike represents the capability for a Chunk to extend Scala's collection library. Because of changes to Scala's collection library in 2.13, separate versions of this trait are implemented for 2.12 and 2.13 / Dotty. This allows code in Chunk to be written without concern for the implementation details of Scala's collection library to the maximum extent possible.

ChunkLike represents the capability for a Chunk to extend Scala's collection library. Because of changes to Scala's collection library in 2.13, separate versions of this trait are implemented for 2.12 and 2.13 / Dotty. This allows code in Chunk to be written without concern for the implementation details of Scala's collection library to the maximum extent possible.

Note that IndexedSeq is not a referentially transparent interface in that it exposes methods that are partial (e.g. apply), allocate mutable state (e.g. iterator), or are purely side effecting (e.g. foreach). Chunk extends IndexedSeq to provide interoperability with Scala's collection library but users should avoid these methods whenever possible.

Attributes

Supertypes
trait IndexedSeq[A]
trait IndexedSeqOps[A, Chunk, Chunk[A]]
trait IndexedSeq[A]
trait IndexedSeqOps[A, Chunk, Chunk[A]]
trait Seq[A]
trait SeqOps[A, Chunk, Chunk[A]]
trait Seq[A]
trait Equals
trait SeqOps[A, Chunk, Chunk[A]]
trait PartialFunction[Int, A]
trait Int => A
trait Iterable[A]
trait Iterable[A]
trait IterableOps[A, Chunk, Chunk[A]]
trait IterableOnceOps[A, Chunk, Chunk[A]]
trait IterableOnce[A]
class Object
trait Matchable
class Any
Show all
Known subtypes
class Chunk[A]
Self type
Chunk[A]
trait Clock extends Serializable

Attributes

Companion
object
Supertypes
trait Serializable
class Object
trait Matchable
class Any
Known subtypes
class ClockJava
object ClockLive.type
Self type
object Clock extends Serializable

Attributes

Companion
trait
Supertypes
trait Serializable
class Object
trait Matchable
class Any
Self type
Clock.type
sealed trait Config[+A]

A zio.Config describes the structure of some configuration data.

A zio.Config describes the structure of some configuration data.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait Composite[A]
class Described[A]
class Fallback[A]
class FallbackWith[A]
class Optional[A]
class Lazy[A]
class MapOrFail[A, B]
class Nested[A]
class Sequence[A]
class Switch[A, B]
class Table[V]
class Zipped[A, B, C]
trait Primitive[A]
object Bool.type
class Constant[A]
object Decimal.type
object Duration.type
class Fail
object Integer.type
object LocalDate.type
object LocalDateTime.type
object LocalTime.type
object OffsetDateTime.type
object SecretType.type
object Text.type
Show all
Self type
Config[A]
object Config

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Config.type

A ConfigProvider is a service that provides configuration given a description of the structure of that configuration.

A ConfigProvider is a service that provides configuration given a description of the structure of that configuration.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
trait Console extends Serializable

Attributes

Companion
object
Supertypes
trait Serializable
class Object
trait Matchable
class Any
Known subtypes
object ConsoleLive.type
Self type
object Console extends Serializable

Attributes

Companion
trait
Supertypes
trait Serializable
class Object
trait Matchable
class Any
Self type
Console.type

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
trait Dequeue[+A] extends Serializable

A queue that can only be dequeued.

A queue that can only be dequeued.

Attributes

Supertypes
trait Serializable
class Object
trait Matchable
class Any
Known subtypes
class Queue[A]
trait Differ[Value, Patch] extends Serializable

A Differ[Value, Patch] knows how to compare an old value and new value of type Value to produce a patch of type Patch that describes the differences between those values. A Differ also knows how to apply a patch to an old value to produce a new value that represents the old value updated with the changes described by the patch.

A Differ[Value, Patch] knows how to compare an old value and new value of type Value to produce a patch of type Patch that describes the differences between those values. A Differ also knows how to apply a patch to an old value to produce a new value that represents the old value updated with the changes described by the patch.

A Differ can be used to construct a FiberRef supporting compositional updates using the FiberRef.makePatch constructor.

The Differ companion object contains constructors for Differ values for common data types such as Chunk, Map, and Set``. In addition,Differvalues can be transformed using thetransformoperator and combined using theorElseEitherandzipoperators. This allows creatingDiffer` values for arbitrarily complex data types compositionally.

Attributes

Companion
object
Supertypes
trait Serializable
class Object
trait Matchable
class Any
Self type
Differ[Value, Patch]
object Differ

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Differ.type
object Duration

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Duration.type

Attributes

Supertypes
class Object
trait Matchable
class Any
final class DurationOps(duration: Duration) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any
final class DurationSyntax(val n: Long) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any
trait Enqueue[-A] extends Serializable

A queue that can only be enqueued.

A queue that can only be enqueued.

Attributes

Supertypes
trait Serializable
class Object
trait Matchable
class Any
Known subtypes
class Hub[A]
class Queue[A]
sealed abstract class ExecutionStrategy

Describes a strategy for evaluating multiple effects, potentially in parallel. There are three possible execution strategies: Sequential, Parallel, and ParallelN.

Describes a strategy for evaluating multiple effects, potentially in parallel. There are three possible execution strategies: Sequential, Parallel, and ParallelN.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Parallel.type
class ParallelN
object Sequential.type

Attributes

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

An executor is responsible for executing actions. Each action is guaranteed to begin execution on a fresh stack frame.

An executor is responsible for executing actions. Each action is guaranteed to begin execution on a fresh stack frame.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Self type
object Executor extends Serializable

Attributes

Companion
class
Supertypes
trait Serializable
class Object
trait Matchable
class Any
Self type
Executor.type
sealed trait Exit[+E, +A] extends ZIO[Any, E, A]

An Exit[E, A] describes the result of executing an IO value. The result is either succeeded with a value A, or failed with a Cause[E].

An Exit[E, A] describes the result of executing an IO value. The result is either succeeded with a value A, or failed with a Cause[E].

Attributes

Companion
object
Supertypes
trait ZIO[Any, E, A]
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Known subtypes
class Failure[E]
class Success[A]
Self type
Exit[E, A]
object Exit extends Serializable

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
trait Serializable
class Object
trait Matchable
class Any
Show all
Self type
Exit.type
final case class ExitCode(code: Int)

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object ExitCode

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
ExitCode.type
abstract class Fiber[+E, +A]

A fiber is a lightweight thread of execution that never consumes more than a whole thread (but may consume much less, depending on contention and asynchronicity). Fibers are spawned by forking ZIO effects, which run concurrently with the parent effect.

A fiber is a lightweight thread of execution that never consumes more than a whole thread (but may consume much less, depending on contention and asynchronicity). Fibers are spawned by forking ZIO effects, which run concurrently with the parent effect.

Fibers can be joined, yielding their result to other fibers, or interrupted, which terminates the fiber, safely releasing all resources.

def parallel[A, B](io1: Task[A], io2: Task[B]): Task[(A, B)] =
 for {
   fiber1 <- io1.fork
   fiber2 <- io2.fork
   a      <- fiber1.join
   b      <- fiber2.join
 } yield (a, b)

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Self type
Fiber[E, A]
object Fiber

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
Fiber.type
final case class FiberFailure(cause: Cause[Any]) extends Throwable

Represents a failure in a fiber. This could be caused by some non- recoverable error, such as a defect or system error, by some typed error, or by interruption (or combinations of all of the above).

Represents a failure in a fiber. This could be caused by some non- recoverable error, such as a defect or system error, by some typed error, or by interruption (or combinations of all of the above).

This class is used to wrap ZIO failures into something that can be thrown, to better integrate with Scala exception handling.

Attributes

Supertypes
trait Product
trait Equals
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
sealed trait FiberId extends Serializable

The identity of a Fiber, described by the time it began life, and a monotonically increasing sequence number generated from an atomic counter.

The identity of a Fiber, described by the time it began life, and a monotonically increasing sequence number generated from an atomic counter.

Attributes

Companion
object
Supertypes
trait Serializable
class Object
trait Matchable
class Any
Known subtypes
class Composite
object None.type
class Runtime
Self type
object FiberId

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
FiberId.type
trait FiberRef[A] extends Serializable

A FiberRef is ZIO's equivalent of Java's ThreadLocal. The value of a FiberRef is automatically propagated to child fibers when they are forked and merged back in to the value of the parent fiber after they are joined.

A FiberRef is ZIO's equivalent of Java's ThreadLocal. The value of a FiberRef is automatically propagated to child fibers when they are forked and merged back in to the value of the parent fiber after they are joined.

for {
 fiberRef <- FiberRef.make("Hello world!")
 child    <- fiberRef.set("Hi!").fork
 _        <- child.join
 result   <- fiberRef.get
} yield result

Here result will be equal to "Hi!" since changes made by a child fiber are merged back in to the value of the parent fiber on join.

By default the value of the child fiber will replace the value of the parent fiber on join but you can specify your own logic for how values should be merged.

for {
 fiberRef <- FiberRef.make(0, identity[Int], math.max)
 child    <- fiberRef.update(_ + 1).fork
 _        <- fiberRef.update(_ + 2)
 _        <- child.join
 value    <- fiberRef.get
} yield value

Here value will be 2 as the value in the joined fiber is lower and we specified max as our combining function.

Attributes

Companion
object
Supertypes
trait Serializable
class Object
trait Matchable
class Any
Known subtypes
class Proxy[A]
class TrackingFiberRef[A]
Self type
object FiberRef

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
FiberRef.type
final class FiberRefs

FiberRefs is a data type that represents a collection of FiberRef values. This allows safely propagating FiberRef values across fiber boundaries, for example between an asynchronous producer and consumer.

FiberRefs is a data type that represents a collection of FiberRef values. This allows safely propagating FiberRef values across fiber boundaries, for example between an asynchronous producer and consumer.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Self type
object FiberRefs

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
FiberRefs.type
abstract class Hub[A] extends Enqueue[A]

A Hub is an asynchronous message hub. Publishers can offer messages to the hub and subscribers can subscribe to take messages from the hub.

A Hub is an asynchronous message hub. Publishers can offer messages to the hub and subscribers can subscribe to take messages from the hub.

Attributes

Companion
object
Supertypes
trait Enqueue[A]
trait Serializable
class Object
trait Matchable
class Any
object Hub

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
Hub.type
sealed abstract class InterruptStatus(val isInterruptible: Boolean) extends Serializable, Product

The InterruptStatus of a fiber determines whether or not it can be interrupted. The status can change over time in different regions.

The InterruptStatus of a fiber determines whether or not it can be interrupted. The status can change over time in different regions.

If a fiber is interruptible but in wind-down mode, then it cannot be interrupted no matter what. The InterruptStatus of a fiber reflects only whether it is within an interruptible or uninterruptible region, regardless of wind-down mode.

Attributes

Companion
object
Supertypes
trait Product
trait Equals
trait Serializable
class Object
trait Matchable
class Any
Show all
Known subtypes
object Interruptible.type
object Uninterruptible.type

Attributes

Companion
class
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
trait IsReloadable[Service]

IsReloadable[Service] provides evidence that we know enough about the structure of a service to create a reloadable version of it.

IsReloadable[Service] provides evidence that we know enough about the structure of a service to create a reloadable version of it.

The reloadable function creates a reloadable instance of the service that forwards every ZIO method call to the underlying service, wrapped in a zio.ScopedRef. The reloadable servservice allows the service to change its behavior at runtime.

Attributes

Note

In order to successfully generate a reloadable service, the type Service must meet the following requirements:

  • Service should be either a trait or a class with a primary constructor without any term parameters.
  • Service should contain only ZIO methods or vals.
  • Service should not have any abstract type members.
Example
 trait MyService { def foo: UIO[String] }
 val service1: MyService = new MyService { def foo = ZIO.succeed("zio1") }
 val service2: MyService = new MyService { def foo = ZIO.succeed("zio2") }
 for {
   ref       <- ScopedRef.make(service1)
   reloadable = IsReloadable[MyService].reloadable(ref)
   res1      <- reloadable.foo
   _         <- ref.set(ZIO.succeed(service2))
   res2      <- reloadable.foo
 } yield assertTrue(res1 == "zio1" && res2 == "zio2")
Companion
object
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
object IsReloadable.type
sealed abstract class IsSubtypeOfError[-A, +B] extends A => B, Serializable

Attributes

Companion
object
Supertypes
trait Serializable
trait A => B
class Object
trait Matchable
class Any

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
sealed abstract class IsSubtypeOfOutput[-A, +B] extends A => B, Serializable

Attributes

Companion
object
Supertypes
trait Serializable
trait A => B
class Object
trait Matchable
class Any

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
final case class LogAnnotation(key: String, value: String)

A LogAnnotation represents a key value pair that allows annotating logs with additional information.

A LogAnnotation represents a key value pair that allows annotating logs with additional information.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class LogLevel(ordinal: Int, label: String, syslog: Int) extends ZIOAspect[Nothing, Any, Nothing, Any, Nothing, Any]

LogLevel represents the log level associated with an individual logging operation. Log levels are used both to describe the granularity (or importance) of individual log statements, as well as to enable tuning verbosity of log output.

LogLevel represents the log level associated with an individual logging operation. Log levels are used both to describe the granularity (or importance) of individual log statements, as well as to enable tuning verbosity of log output.

Value parameters

label

A label associated with the log level.

ordinal

The priority of the log message. Larger values indicate higher priority.

syslog

The syslog severity level of the log level. LogLevel values are ZIO aspects, and therefore can be used with aspect syntax.

myEffect @@ LogLevel.Info

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait ZIOAspect[Nothing, Any, Nothing, Any, Nothing, Any]
class Object
trait Matchable
class Any
Show all
Self type
object LogLevel

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
LogLevel.type
final case class LogSpan(label: String, startTime: Long)

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final class NonEmptyChunk[+A] extends Serializable

A NonEmptyChunk is a Chunk that is guaranteed to contain at least one element. As a result, operations which would not be safe when performed on Chunk, such as head or reduce, are safe when performed on NonEmptyChunk. Operations on NonEmptyChunk which could potentially return an empty chunk will return a Chunk instead.

A NonEmptyChunk is a Chunk that is guaranteed to contain at least one element. As a result, operations which would not be safe when performed on Chunk, such as head or reduce, are safe when performed on NonEmptyChunk. Operations on NonEmptyChunk which could potentially return an empty chunk will return a Chunk instead.

Attributes

Companion
object
Supertypes
trait Serializable
class Object
trait Matchable
class Any
Self type
object NonEmptyChunk

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
final class Promise[E, A] extends Serializable

A promise represents an asynchronous variable, of zio.ZIO type, that can be set exactly once, with the ability for an arbitrary number of fibers to suspend (by calling await) and automatically resume when the variable is set.

A promise represents an asynchronous variable, of zio.ZIO type, that can be set exactly once, with the ability for an arbitrary number of fibers to suspend (by calling await) and automatically resume when the variable is set.

Promises can be used for building primitive actions whose completions require the coordinated action of multiple fibers, and for building higher-level concurrent or asynchronous structures.

for {
 promise <- Promise.make[Nothing, Int]
 _       <- promise.succeed(42).delay(1.second).fork
 value   <- promise.await // Resumes when forked fiber completes promise
} yield value

Attributes

Companion
object
Supertypes
trait Serializable
class Object
trait Matchable
class Any
object Promise

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
Promise.type
final class ProvideSomePartiallyApplied[R0, -R, +E, +A](val self: ZIO[R, E, A]) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any
abstract class Queue[A] extends Dequeue[A], Enqueue[A]

A Queue is a lightweight, asynchronous queue into which values can be enqueued and of which elements can be dequeued.

A Queue is a lightweight, asynchronous queue into which values can be enqueued and of which elements can be dequeued.

Attributes

Companion
object
Supertypes
trait Enqueue[A]
trait Dequeue[A]
trait Serializable
class Object
trait Matchable
class Any
Show all
object Queue

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
Queue.type
trait Random extends Serializable

Attributes

Companion
object
Supertypes
trait Serializable
class Object
trait Matchable
class Any
Known subtypes
object RandomLive.type
class RandomScala
Self type
object Random extends Serializable

Attributes

Companion
trait
Supertypes
trait Serializable
class Object
trait Matchable
class Any
Self type
Random.type
abstract class Ref[A] extends Serializable

A Ref is a purely functional description of a mutable reference. The fundamental operations of a Ref are set and get. set sets the reference to a new value. get gets the current value of the reference.

A Ref is a purely functional description of a mutable reference. The fundamental operations of a Ref are set and get. set sets the reference to a new value. get gets the current value of the reference.

By default, Ref is implemented in terms of compare and swap operations for maximum performance and does not support performing effects within update operations. If you need to perform effects within update operations you can create a Ref.Synchronized, a specialized type of Ref that supports performing effects within update operations at some cost to performance. In this case writes will semantically block other writers, while multiple readers can read simultaneously.

NOTE: While Ref provides the functional equivalent of a mutable reference, the value inside the Ref should normally be immutable since compare and swap operations are not safe for mutable values that do not support concurrent access. If you do need to use a mutable value Ref.Synchronized will guarantee that access to the value is properly synchronized.

Attributes

Companion
object
Supertypes
trait Serializable
class Object
trait Matchable
class Any
Known subtypes
class Synchronized[A]
object Ref extends Serializable

Attributes

Companion
class
Supertypes
trait Serializable
class Object
trait Matchable
class Any
Self type
Ref.type
final case class Reloadable[Service](scopedRef: ScopedRef[Service], reload: IO[Any, Unit])

A Reloadable is an implementation of some service that can be dynamically reloaded, or swapped out for another implementation on-the-fly.

A Reloadable is an implementation of some service that can be dynamically reloaded, or swapped out for another implementation on-the-fly.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Reloadable

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Reloadable.type
trait Runtime[+R]

A Runtime[R] is capable of executing tasks within an environment R.

A Runtime[R] is capable of executing tasks within an environment R.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Proxy[R]
class Scoped[R]
Self type
Runtime[R]
object Runtime

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Runtime.type
sealed trait RuntimeFlag

A RuntimeFlag is a flag that can be set to enable or disable a particular feature of the ZIO runtime.

A RuntimeFlag is a flag that can be set to enable or disable a particular feature of the ZIO runtime.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object CooperativeYielding.type
object CurrentFiber.type
object FiberRoots.type
object Interruption.type
object OpLog.type
object OpSupervision.type
object RuntimeMetrics.type
object WindDown.type
object WorkStealing.type
Show all
object RuntimeFlag

Attributes

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

Maintains a set of runtime flags. Runtime flags affect the operation of the ZIO runtime system. They are exposed to application-level code because they affect the behavior and performance of application code.

Maintains a set of runtime flags. Runtime flags affect the operation of the ZIO runtime system. They are exposed to application-level code because they affect the behavior and performance of application code.

For more information on individual flags, see zio.RuntimeFlag.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
trait Schedule[-Env, -In, +Out] extends Serializable

A Schedule[Env, In, Out] defines a recurring schedule, which consumes values of type In, and which returns values of type Out.

A Schedule[Env, In, Out] defines a recurring schedule, which consumes values of type In, and which returns values of type Out.

Schedules are defined as a possibly infinite set of intervals spread out over time. Each interval defines a window in which recurrence is possible.

When schedules are used to repeat or retry effects, the starting boundary of each interval produced by a schedule is used as the moment when the effect will be executed again.

Schedules compose in the following primary ways:

  • Union. This performs the union of the intervals of two schedules. * Intersection. This performs the intersection of the intervals of two schedules. * Sequence. This concatenates the intervals of one schedule onto another.

In addition, schedule inputs and outputs can be transformed, filtered (to terminate a schedule early in response to some input or output), and so forth.

A variety of other operators exist for transforming and combining schedules, and the companion object for Schedule contains all common types of schedules, both for performing retrying, as well as performing repetition.

Attributes

Companion
object
Supertypes
trait Serializable
class Object
trait Matchable
class Any
Self type
Schedule[Env, In, Out]
object Schedule

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Schedule.type
abstract class Scheduler

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object Scheduler

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
Scheduler.type
trait Scope extends Serializable

A Scope is the foundation of safe, composable resource management in ZIO. A scope has two fundamental operators, addFinalizer, which adds a finalizer to the scope, and close, which closes a scope and runs all finalizers that have been added to the scope.

A Scope is the foundation of safe, composable resource management in ZIO. A scope has two fundamental operators, addFinalizer, which adds a finalizer to the scope, and close, which closes a scope and runs all finalizers that have been added to the scope.

Attributes

Companion
object
Supertypes
trait Serializable
class Object
trait Matchable
class Any
Known subtypes
trait Closeable
Self type
object Scope

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Scope.type
trait ScopedRef[A]

A ScopedRef is a reference whose value is associated with resources, which must be released properly. You can both get the current value of any ScopedRef, as well as set it to a new value (which may require new resources). The reference itself takes care of properly releasing resources for the old value whenever a new value is obtained.

A ScopedRef is a reference whose value is associated with resources, which must be released properly. You can both get the current value of any ScopedRef, as well as set it to a new value (which may require new resources). The reference itself takes care of properly releasing resources for the old value whenever a new value is obtained.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object ScopedRef

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
ScopedRef.type
sealed trait Semaphore extends Serializable

An asynchronous semaphore, which is a generalization of a mutex. Semaphores have a certain number of permits, which can be held and released concurrently by different parties. Attempts to acquire more permits than available result in the acquiring fiber being suspended until the specified number of permits become available.

An asynchronous semaphore, which is a generalization of a mutex. Semaphores have a certain number of permits, which can be held and released concurrently by different parties. Attempts to acquire more permits than available result in the acquiring fiber being suspended until the specified number of permits become available.

If you need functionality that Semaphore doesnt' provide, use a TSemaphore and define it in a zio.stm.ZSTM transaction.

Attributes

Companion
object
Supertypes
trait Serializable
class Object
trait Matchable
class Any
object Semaphore

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Semaphore.type
final case class StackTrace(fiberId: FiberId, stackTrace: Chunk[Trace])

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Self type
object StackTrace

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
StackTrace.type
abstract class Supervisor[+A]

A Supervisor[A] is allowed to supervise the launching and termination of fibers, producing some visible value of type A from the supervision.

A Supervisor[A] is allowed to supervise the launching and termination of fibers, producing some visible value of type A from the supervision.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Self type
object Supervisor

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
Supervisor.type
trait System extends Serializable

Attributes

Companion
object
Supertypes
trait Serializable
class Object
trait Matchable
class Any
Known subtypes
object SystemLive.type
Self type
object System extends Serializable

Attributes

Companion
trait
Supertypes
trait Serializable
class Object
trait Matchable
class Any
Self type
System.type
object Tag extends TagVersionSpecific

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Tag.type
trait Tag[A] extends Tag[A]

Attributes

Companion
object
Supertypes
trait Tag[A]
trait AnyTag
trait Serializable
class Object
trait Matchable
class Any
Show all

Attributes

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

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
object Trace

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Trace.type
sealed trait Unsafe extends Serializable

A marker interface used to indicate that a method is side-effecting, partial, or potentially type unsafe, such that it might throw a ClassCastException if used improperly. This marker interface is useful for certain low-level ZIO methods, to differentiate them from the higher-level methods, which are always pure, total, and type-safe.

A marker interface used to indicate that a method is side-effecting, partial, or potentially type unsafe, such that it might throw a ClassCastException if used improperly. This marker interface is useful for certain low-level ZIO methods, to differentiate them from the higher-level methods, which are always pure, total, and type-safe.

import Unsafe.unsafe

unsafe { ... }

Attributes

Companion
object
Supertypes
trait Serializable
class Object
trait Matchable
class Any
object Unsafe

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Unsafe.type
trait Unzippable[A, B]

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Show all
Self type
Unzippable.type

Attributes

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

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
final class WirePartiallyApplied[R](val dummy: Boolean) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any
final class WireSomePartiallyApplied[R0, R](val dummy: Boolean) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any
final class ZEnvironment[+R] extends Serializable

Attributes

Companion
object
Supertypes
trait Serializable
class Object
trait Matchable
class Any
Self type
object ZEnvironment

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
sealed trait ZIO[-R, +E, +A] extends Product, Serializable

A ZIO[R, E, A] value is an immutable value (called an "effect") that describes an async, concurrent workflow. In order to be executed, the workflow requires a value of type ZEnvironment[R], and when executed, the workflow will either produce a failure of type E, or a success of type A.

A ZIO[R, E, A] value is an immutable value (called an "effect") that describes an async, concurrent workflow. In order to be executed, the workflow requires a value of type ZEnvironment[R], and when executed, the workflow will either produce a failure of type E, or a success of type A.

ZIO effects may informally be thought of as functions of the following form:

ZEnvironment[R] => Either[E, A]

ZIO effects model resourceful interaction with the outside world, including synchronous, asynchronous, concurrent, and parallel interaction.

The async and concurrent operations of ZIO effects are powered by fibers, which are lightweight, green threads that enable high scalability.

To run an effect, you need a Runtime, which is capable of executing effects. Runtimes bundle a thread pool together with the environment that effects need.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Known subtypes
trait Exit[E, A]
class Failure[E]
class Success[A]
Self type
ZIO[R, E, A]

Attributes

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

An entry point for a ZIO application that allows sharing layers between applications. For a simpler version that uses the default ZIO environment see ZIOAppDefault.

An entry point for a ZIO application that allows sharing layers between applications. For a simpler version that uses the default ZIO environment see ZIOAppDefault.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Proxy
Self type
object ZIOApp

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
ZIOApp.type
final case class ZIOAppArgs(getArgs: Chunk[String])

A service that contains command-line arguments of an application.

A service that contains command-line arguments of an application.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object ZIOAppArgs

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
ZIOAppArgs.type
trait ZIOAppDefault extends ZIOApp

The entry point for a ZIO application.

The entry point for a ZIO application.

import zio.ZIOAppDefault
import zio.Console._

object MyApp extends ZIOAppDefault {

 def run =
   for {
     _ <- printLine("Hello! What is your name?")
     n <- readLine
     _ <- printLine("Hello, " + n + ", good to meet you!")
   } yield ()
}

Attributes

Companion
object
Supertypes
trait ZIOApp
class Object
trait Matchable
class Any
object ZIOAppDefault

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait ZIOApp
class Proxy

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
trait ZIOAspect[+LowerR, -UpperR, +LowerE, -UpperE, +LowerA, -UpperA]

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait Metric[Type, In, Out]
class LogLevel
Self type
ZIOAspect[LowerR, UpperR, LowerE, UpperE, LowerA, UpperA]
object ZIOAspect

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
ZIOAspect.type

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
object ZIO.type
trait ZInputStream

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object ZInputStream

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
trait ZKeyedPool[+Err, -Key, Item]

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object ZKeyedPool

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
ZKeyedPool.type
sealed abstract class ZLayer[-RIn, +E, +ROut]

A ZLayer[E, A, B] describes how to build one or more services in your application. Services can be injected into effects via ZIO#provide. Effects can require services via ZIO.service."

A ZLayer[E, A, B] describes how to build one or more services in your application. Services can be injected into effects via ZIO#provide. Effects can require services via ZIO.service."

Layer can be thought of as recipes for producing bundles of services, given their dependencies (other services).

Construction of services can be effectful and utilize resources that must be acquired and safely released when the services are done being utilized.

By default layers are shared, meaning that if the same layer is used twice the layer will only be allocated a single time.

Because of their excellent composition properties, layers are the idiomatic way in ZIO to create services that depend on other services.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Self type
ZLayer[RIn, E, ROut]

Attributes

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

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
object ZLayer.type
trait ZLogger[-Message, +Output]

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Self type
ZLogger[Message, Output]
object ZLogger

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
ZLogger.type

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object ZOutputStream

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
trait ZPool[+Error, Item]

A ZPool[E, A] is a pool of items of type A, each of which may be associated with the acquisition and release of resources. An attempt to get an item A from a pool may fail with an error of type E.

A ZPool[E, A] is a pool of items of type A, each of which may be associated with the acquisition and release of resources. An attempt to get an item A from a pool may fail with an error of type E.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object ZPool

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
ZPool.type
sealed trait ZState[S]

ZState[S] models a value of type S that can be read from and written to during the execution of an effect. The idiomatic way to work with ZState is as part of the environment using operators defined on ZIO. For example:

ZState[S] models a value of type S that can be read from and written to during the execution of an effect. The idiomatic way to work with ZState is as part of the environment using operators defined on ZIO. For example:

final case class MyState(counter: Int)

for {
 _     <- ZIO.updateState[MyState](state => state.copy(counter = state.counter + 1))
 count <- ZIO.getStateWith[MyState](_.counter)
} yield count

Because ZState is typically used as part of the environment, it is recommended to define your own state type S such as MyState above rather than using a type such as Int to avoid the risk of ambiguity.

To run a stateful workflow, use the ZIO.stateful operator to allocate the initial state.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object ZState

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
ZState.type
trait Zippable[-A, -B]

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Show all
Self type
Zippable.type

Attributes

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

Attributes

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

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes

Experimental classlikes

object Experimental

Attributes

Experimental
true
Supertypes
class Object
trait Matchable
class Any
Self type

Types

type IO[+E, +A] = ZIO[Any, E, A]
type Layer[+E, +ROut] = ZLayer[Any, E, ROut]
type RIO[-R, +A] = ZIO[R, Throwable, A]
type RLayer[-RIn, +ROut] = ZLayer[RIn, Throwable, ROut]
type RuntimeFlags = Int
type Task[+A] = ZIO[Any, Throwable, A]
type TaskLayer[+ROut] = ZLayer[Any, Throwable, ROut]
type Trace = Type & Traced
type UIO[+A] = ZIO[Any, Nothing, A]
type ULayer[+ROut] = ZLayer[Any, Nothing, ROut]
type URIO[-R, +A] = ZIO[R, Nothing, A]
type URLayer[-RIn, +ROut] = ZLayer[RIn, Nothing, ROut]
type ZAny = Any
type ZNothing = Nothing

Inherited types

type BuildFrom[-From, -A, +C] = BuildFrom[From, A, C]

Attributes

Inherited from:
BuildFromCompat (hidden)

Attributes

Inherited from:
DurationModule
type EnvironmentTag[A] = Tag[A]

Attributes

Inherited from:
VersionSpecific (hidden)

Attributes

Inherited from:
VersionSpecific (hidden)
type TagK[F[_]] = Tag[F]

Attributes

Inherited from:
VersionSpecific (hidden)
type TagK10[F[_, _, _, _, _, _, _, _, _, _]] = Tag[F]

Attributes

Inherited from:
VersionSpecific (hidden)
type TagK11[F[_, _, _, _, _, _, _, _, _, _, _]] = Tag[F]

Attributes

Inherited from:
VersionSpecific (hidden)
type TagK12[F[_, _, _, _, _, _, _, _, _, _, _, _]] = Tag[F]

Attributes

Inherited from:
VersionSpecific (hidden)
type TagK13[F[_, _, _, _, _, _, _, _, _, _, _, _, _]] = Tag[F]

Attributes

Inherited from:
VersionSpecific (hidden)
type TagK14[F[_, _, _, _, _, _, _, _, _, _, _, _, _, _]] = Tag[F]

Attributes

Inherited from:
VersionSpecific (hidden)
type TagK15[F[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _]] = Tag[F]

Attributes

Inherited from:
VersionSpecific (hidden)
type TagK16[F[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _]] = Tag[F]

Attributes

Inherited from:
VersionSpecific (hidden)
type TagK17[F[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _]] = Tag[F]

Attributes

Inherited from:
VersionSpecific (hidden)
type TagK18[F[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _]] = Tag[F]

Attributes

Inherited from:
VersionSpecific (hidden)
type TagK19[F[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _]] = Tag[F]

Attributes

Inherited from:
VersionSpecific (hidden)
type TagK20[F[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _]] = Tag[F]

Attributes

Inherited from:
VersionSpecific (hidden)
type TagK21[F[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _]] = Tag[F]

Attributes

Inherited from:
VersionSpecific (hidden)
type TagK22[F[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _]] = Tag[F]

Attributes

Inherited from:
VersionSpecific (hidden)
type TagK3[F[_, _, _]] = Tag[F]

Attributes

Inherited from:
VersionSpecific (hidden)
type TagK4[F[_, _, _, _]] = Tag[F]

Attributes

Inherited from:
VersionSpecific (hidden)
type TagK5[F[_, _, _, _, _]] = Tag[F]

Attributes

Inherited from:
VersionSpecific (hidden)
type TagK6[F[_, _, _, _, _, _]] = Tag[F]

Attributes

Inherited from:
VersionSpecific (hidden)
type TagK7[F[_, _, _, _, _, _, _]] = Tag[F]

Attributes

Inherited from:
VersionSpecific (hidden)
type TagK8[F[_, _, _, _, _, _, _, _]] = Tag[F]

Attributes

Inherited from:
VersionSpecific (hidden)
type TagK9[F[_, _, _, _, _, _, _, _, _]] = Tag[F]

Attributes

Inherited from:
VersionSpecific (hidden)
type TagKK[F[_, _]] = Tag[F]

Attributes

Inherited from:
VersionSpecific (hidden)

Value members

Inherited fields

lazy val EnvironmentTag: Tag.type

Attributes

Inherited from:
VersionSpecific (hidden)
lazy val TagK: TagK.type

Attributes

Inherited from:
VersionSpecific (hidden)
lazy val TagK3: TagK3.type

Attributes

Inherited from:
VersionSpecific (hidden)
lazy val TagKK: TagKK.type

Attributes

Inherited from:
VersionSpecific (hidden)

Implicits

Inherited implicits

implicit def buildFromNothing[Collection <: ([Element] =>> Iterable[Element] & IterableOps[Any, LazyRef(...), _])]: BuildFrom[Collection[Any], Nothing, Collection[Nothing]]

Attributes

Inherited from:
BuildFromCompat (hidden)
implicit def duration2DurationOps(duration: Duration): DurationOps

Attributes

Inherited from:
DurationModule
implicit def durationInt(n: Int): DurationSyntax

Attributes

Inherited from:
DurationModule
implicit def durationLong(n: Long): DurationSyntax

Attributes

Inherited from:
DurationModule

Attributes

Inherited from:
DurationModule