InjectEnv

@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.

Type parameters:
F

the higher-kinded type of a polymorphic effect

R

the type of ZIO environment

Companion:
object
class Object
trait Matchable
class Any

Value members

Abstract methods

def inject[A](fa: F[A], env: R): F[A]

Injects the given environment R into the effect F.

Injects the given environment R into the effect F.

def modify(env: R): F[R]

Modifies zio.RIO environment before re-injecting it into zio.RIO and F.

Modifies zio.RIO environment before re-injecting it into zio.RIO and F.

Value parameters:
env

an environment taken from zio.RIO

See also:

See ToEffect for a particular usage.