zio.blocks.context.ContextHas
See theContextHas companion object
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
- Graph
-
- Supertypes
In this article