Default

zio.ZLayer.Derive.Default
See theDefault companion trait
object Default

Attributes

Companion
trait
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Default.type

Members list

Type members

Classlikes

final implicit class ZLayerDefaultInvariantOps[R, E, A](self: WithContext[R, E, A]) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any

Types

type WithContext[R0, E0, A] = Default[A] { type R = R0; type E = E0; }

Value members

Concrete methods

def apply[A](implicit ev: Default[A]): WithContext[ev.R, ev.E, A]

Summons the implicit default for the specified type.

Summons the implicit default for the specified type.

Attributes

def fromLayer[R0, E0, A : Tag](zlayer: => ZLayer[R0, E0, A])(implicit evidence$1: Tag[A], trace: Trace): WithContext[R0, E0, A]

Uses the provided layer as the default layer.

Uses the provided layer as the default layer.

Attributes

def fromZIO[R, E, A : Tag](zio: => ZIO[R, E, A])(implicit evidence$1: Tag[A], trace: Trace): WithContext[R, E, A]

Constructs a default layer using the provided ZIO value.

Constructs a default layer using the provided ZIO value.

Attributes

def service[A : Tag](implicit evidence$1: Tag[A], trace: Trace): WithContext[A, Nothing, A]

Makes a default value that requires the specified service from the environment.

Makes a default value that requires the specified service from the environment.

Used to discard a predefined Default instance for ZLayer.derive.

Attributes

Example
class Wheels(number: Int)
object Wheels {
 implicit val defaultWheels: ZLayer.Default.WithContext[Any, Nothing, Wheels] =
   ZLayer.Default.succeed(new Wheels(4))
}
class Car(wheels: Wheels)
val carLayer1: ULayer[Car] = ZLayer.derive // wheels.number == 4
val carLayer2: URLayer[Wheels, Car] = locally {
 // The default instance is discarded
 implicit val newWheels: ZLayer.Default.WithContext[Wheels, Nothing, Wheels] =
     ZLayer.Default.service[Wheels]
 ZLayer.derive[Car]
}
def succeed[A : Tag](a: => A)(implicit evidence$1: Tag[A], trace: Trace): WithContext[Any, Nothing, A]

Constructs a default layer using the provided value.

Constructs a default layer using the provided value.

Attributes

Implicits

Implicits

final implicit def ZLayerDefaultInvariantOps[R, E, A](self: WithContext[R, E, A]): ZLayerDefaultInvariantOps[R, E, A]
implicit def deriveDefaultConfig[A : Tag](implicit evidence$1: Tag[A], ev: Config[A], trace: Trace): WithContext[Any, Error, A]
implicit def deriveDefaultHub[A : Tag](implicit evidence$1: Tag[A], trace: Trace): WithContext[Any, Nothing, Hub[A]]
implicit def deriveDefaultPromise[E : Tag, A : Tag](implicit evidence$1: Tag[E], evidence$2: Tag[A], trace: Trace): WithContext[Any, Nothing, Promise[E, A]]
implicit def deriveDefaultQueue[A : Tag](implicit evidence$1: Tag[A], trace: Trace): WithContext[Any, Nothing, Queue[A]]
implicit def deriveDefaultRef[A : Tag](implicit evidence$1: Tag[A], ev: Default[A], trace: Trace): WithContext[ev.R, ev.E, Ref[A]]

Inherited implicits

implicit def defaultPromiseNothing[A : Tag](implicit evidence$1: Tag[A], trace: Trace): WithContext[Any, Nothing, Promise[Nothing, A]]

Attributes

Inherited from:
DefaultInstances0 (hidden)