caliban.interop.cats

Type members

Classlikes

@implicitNotFound("\nCould not find `CatsInterop` for effect ${F} and environment ${R}. `CatsInterop` can be one of the following:\n\n1) Non-contextual: default conversion between RIO and ${F}. A way to go for non-contextual effects (e.g. `cats.effect.IO`):\n\nimplicit val runtime: Runtime[${R}] = ???\nval dispatcher: Dispatcher[${F}] = ???\n\nimplicit val catsInterop: CatsInterop[${F}, ${R}] = CatsInterop.default(dispatcher)\n\n2) Contextual: injects ZIO environment into underlying effect. Can be used to share a context between ZIO and Kleisli-like effects:\n\ncase class Context(isAdmin: Boolean)\ntype Effect[A] = Kleisli[IO, Context, A]\n\nval dispatcher: Dispatcher[Effect] = ???\n\nimplicit val runtime: Runtime[Context] = ???\nimplicit val injectContext: InjectEnv[Effect, Context] = InjectEnv.kleisli\nimplicit val catsInterop: CatsInterop[Effect, Context] = CatsInterop.contextual(dispatcher)\n\n")
trait CatsInterop[F[_], R] extends FromEffect[F, R] with ToEffect[F, R]

Interop between F and zio.RIO. The combination of ToEffect and FromEffect.

Interop between F and zio.RIO. The combination of ToEffect and FromEffect.

Describes how zio.RIO can be created from a polymorphic effect F. Describes how a polymorphic effect F can be created from zio.RIO.

Type parameters:
F

the higher-kinded type of a polymorphic effect

R

the type of ZIO environment

Companion:
object
Companion:
class
@implicitNotFound("\nCould not find `FromEffect` for effect ${F} and environment ${R}. `FromEffect` can be one of the following:\n\n1) Non-contextual: derived automatically when `cats.effect.std.Dispatcher` is available in the implicit scope. A way to go for non-contextual effects (e.g. `cats.effect.IO`):\n\nimplicit val dispatcher: Dispatcher[${F}] = ???\n\nval fromEffect: FromEffect[${F}, ${R}] = implicitly // or an explicit call `FromEffect.forDispatcher`\n\n2) Contextual: injects ZIO environment into underlying effect. Can be used to share a context between ZIO and Kleisli-like effects:\n\ncase class Context(isAdmin: Boolean)\ntype Effect[A] = Kleisli[IO, Context, A]\n\nval dispatcher: Dispatcher[Effect] = ???\n\nimplicit val injectContext: InjectEnv[Effect, Context] = InjectEnv.kleisli\nimplicit val fromEffect: FromEffect[Effect, Context] = FromEffect.contextual(dispatcher)\n\n")
trait FromEffect[F[_], R]

Describes how zio.RIO can be created from a polymorphic effect F.

Describes how zio.RIO can be created from a polymorphic effect F.

Type parameters:
F

the higher-kinded type of a polymorphic effect

R

the type of ZIO environment

Companion:
object
object FromEffect
Companion:
class
@implicitNotFound("\nCould not find `InjectEnv` for effect ${F} and environment ${R}. `InjectEnv` can be one of the following:\n\n1) Kleisli: injects given environment into the underlying effect in cats.data.Kleisli:\n\ncase class Context(isAdmin: Boolean)\ntype Eff[A] = Kleisli[IO, Context, A]\n\nimplicit val injectContext: InjectEnv[Eff, Context] = InjectEnv.kleisli\n\n2) Kleisli + lens: injects a zoomed value (via lens) of the given environment into the underlying effect in Kleisli:\n\ncase class Security(isAdmin: Boolean)\ncase class Context(security: Security, lastAccess: Instant)\n\ntype Eff[A] = Kleisli[IO, Security, A]\n\nimplicit val injectSecurity: InjectEnv[Eff, Context] =\n InjectEnv.kleisliLens(_.security, (ctx, security) => ctx.copy(security = security))\n\n")
trait InjectEnv[F[_], R]

Injects a given environment of type R into the effect F.

Injects a given environment of type R into the effect F.

Type parameters:
F

the higher-kinded type of a polymorphic effect

R

the type of ZIO environment

Companion:
object
object InjectEnv
Companion:
class
@implicitNotFound("\nCould not find `ToEffect` for effect ${F} and environment ${R}. `ToEffect` can be one of the following:\n\n1) Non-contextual: derived automatically when `cats.effect.Async` and `Runtime` are available in the implicit scope. A way to go for non-contextual effects (e.g. `cats.effect.IO`):\n\nimplicit val async: Async[${F}] = ???\nimplicit val runtime: Runtime[${R}] = ???\nimplicit val toEffect: ToEffect[${F}, ${R}] = implicitly // or an explicit call `ToEffect.forAsync`\n\n2) Contextual: injects ZIO environment into underlying effect. Can be used to share a context between ZIO and Kleisli-like effects:\n\ncase class Context(isAdmin: Boolean)\ntype Effect[A] = Kleisli[IO, Context, A]\n\nval dispatcher: Dispatcher[Effect] = ???\n\nimplicit val runtime: Runtime[Context] = ???\nimplicit val injectContext: InjectEnv[Effect, Context] = InjectEnv.kleisli\nimplicit val toEffect: ToEffect[Effect, Context] = ToEffect.contextual\n\n")
trait ToEffect[F[_], R]

Describes how a polymorphic effect F can be created from zio.RIO.

Describes how a polymorphic effect F can be created from zio.RIO.

Type parameters:
F

the higher-kinded type of a polymorphic effect

R

the type of ZIO environment

Companion:
object
object ToEffect
Companion:
class