zio.blocks.context
Members list
Type members
Classlikes
This object was generated by sbt-buildinfo.
This object was generated by sbt-buildinfo.
Attributes
- Source
- BuildInfo.scala
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
- Self type
-
BuildInfo.type
A type-indexed heterogeneous collection that stores values indexed by their types.
A type-indexed heterogeneous collection that stores values indexed by their types.
Context provides compile-time type safety for storing and retrieving values of different types. The phantom type parameter R tracks which types are present in the context, enabling the type system to verify that requested values exist.
Type parameters
- R
-
The phantom type representing the types stored in this context. Uses intersection types (A & B) to represent multiple stored types.
Attributes
- Companion
- object
- Source
- Context.scala
- Supertypes
- Self type
-
Context[R]
Attributes
- Companion
- class
- Source
- Context.scala
- Supertypes
- Self type
-
Context.type
Compile-time evidence that a context of type Ctx provides all types in A.
Compile-time evidence that a context of type Ctx provides all types in A.
Resolves when Ctx <: A. For intersection types this means every component of A must appear in Ctx:
// resolves: (Server & Database & Logger) <: (Database & Logger)
implicitly[ContextHas[Server & Database & Logger, Database & Logger]]
// fails: (Server & Database) is not <: (Database & Logger)
implicitly[ContextHas[Server & Database, Database & Logger]]
// → "Context[Server & Database] does not provide Database & Logger.
// Compare the two types — each component of Database & Logger
// not in Server & Database must be added via context.add(value)."
Typical usage — one implicit checks everything:
def serve[ReqCtx, Ctx](routes: Routes[ReqCtx], context: Context[Ctx])(implicit
ev: ContextHas[Ctx, ReqCtx & Server]
): ServerHandle = ???
Attributes
- Companion
- object
- Source
- ContextHas.scala
- Supertypes
Attributes
- Companion
- trait
- Source
- ContextHas.scala
- Supertypes
- Self type
-
ContextHas.type