Object

polynote.kernel.environment

Env

Related Doc: package environment

Permalink

object Env

Some utilities for enrichment of environment

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Env
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. final class Add[RO, R] extends AnyVal

    Permalink
  2. final class AddM[RO, -RA, RB, +E] extends AnyVal

    Permalink
  3. class AddMPartial[RO] extends AnyRef

    Permalink
  4. class AddPartial[RO] extends AnyRef

    Permalink
  5. class Enricher[A] extends AnyRef

    Permalink
  6. class MEnricher[A] extends AnyRef

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def add[RO]: AddPartial[RO]

    Permalink

    Add a new type to the environment inside a for-comprehension.

    Add a new type to the environment inside a for-comprehension. This variant is for an environment that's constructed directly.

    This method takes the "current" environment type, and enriches it with the given value. The remainder of the for-comprehension can then access that environment. For example, instead of this:

    for { someValue <- computeThing myEnv1 <- Env.enrich[Env1 with Env2](CreateMyEnv(someValue)) thing1 <- doThing1.provide(myEnv1) thing2 <- doThing2.provide(myEnv1) // etc } yield thing2

    You can do this:

    for { someValue <- computeThing _ <- Env.add[Env1 with Env2](CreateMyEnv(someValue)) thing1 <- doThing1 thing2 <- doThing2 } yield thing2

    The MyEnv environment is automatically provided to the continuation after Env.add, so it doesn't have to be named and explicitly provided everywhere.

  5. def addM[RO]: AddMPartial[RO]

    Permalink

    Add a new type to the environment inside a for-comprehension.

    Add a new type to the environment inside a for-comprehension. This variant is for an environment that's constructed effectfully.

    This method takes the "current" environment type, and enriches it with the given value. The remainder of the for-comprehension can then access that environment. For example, instead of this:

    for { someValue <- computeThing myEnv1 <- Env.enrichM[Env1 with Env2](CreateMyEnv(someValue)) thing1 <- doThing1.provide(myEnv1) thing2 <- doThing2.provide(myEnv1) // etc } yield thing2

    You can do this:

    for { someValue <- computeThing _ <- Env.addM[Env1 with Env2](CreateMyEnv(someValue)) thing1 <- doThing1 thing2 <- doThing2 } yield thing2

    The MyEnv environment is automatically provided to the continuation after Env.addM, so it doesn't have to be named and explicitly provided everywhere.

  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. def enrich[A]: Enricher[A]

    Permalink

    A partially applied enrichment.

    A partially applied enrichment. Provide as a type parameter the type that will be pulled from the ZIO environment and enriched, and as a value parameter the value that will be added (its type can typically be inferred).

    Example: val zio: ZIO[Thing1 with Thing2 with Thing3, Nothing, Int] = ??? val thing3: Thing3 = ??? zio.provideSomeM(Env.enrich[Thing1 with Thing2](thing3)) // result: ZIO[Thing1 with Thing2, Nothing, Int]

  9. def enrichM[A]: MEnricher[A]

    Permalink

    A partially applied enrichment.

    A partially applied enrichment. Provide as a type parameter the type that will be pulled from the ZIO environment and enriched, and as a value parameter an effect that will produce the value that will be added (its type can typically be inferred).

    Example: val zio: ZIO[Thing1 with Thing2 with Thing3, Nothing, Int] = ??? val thing3: ZIO[Thing1, Nothing, Thing3] = ??? zio.provideSomeM(Env.enrichM[Thing1 with Thing2](thing3)) // result: ZIO[Thing1 with Thing2, Nothing, Int]

  10. def enrichWith[A, B](a: A, b: B)(implicit enrich: Enrich[A, B]): A with B

    Permalink

    Enrich A with B, resulting in a value that is both A and B.

    Enrich A with B, resulting in a value that is both A and B. This is intended for ZIO environments, and as such, A and B must be traits. It's a good practice for each of these traits to have exactly one abstract method which provides that environment's aspect.

    The returned value will implement A and B, delegating all of A's methods to the given A and all of B's methods to the given B. If A already extends B, the methods of B will be replaced to delegate to the given instance of B.

    See also

    Enrich for the macro implementation.

  11. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  12. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  13. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  14. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  15. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  16. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  17. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  18. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  19. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  20. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  21. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  22. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped