Packages

trait Context[F[_]] extends AnyRef

An abstraction that can construct an instance of the Local mtl algebra without any constraints.

You gain the (cap)ability to introduce a new instance of Local for any type, anywhere a Context is present.

For programs written in cats.data.Kleisli or tagless final, Context provides the ability to introduce new Local instances without having to lift any algebras or penalize your performance.

Nested use of Context is well defined.

Source
Context.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Context
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Abstract Value Members

  1. abstract def allocated[C](implicit sp: SourcePos): F[Local[F, C]]

    The low-level primitive which makes up a Context.

    The low-level primitive which makes up a Context. This api is low-level and potentially unsafe, so use it with caution.

    allocated is more powerful than use in that you can write a program with Local without having an initial value yet. Allocated let's the user choose when to provide the initial value in either through set or a natural transformation C => F ~> F.

    If an effect F that depends on Local is not provided with an initial value, through either set or setK, a detailed runtime error will be raised.

    For instance, here is a good use-case for allocated.

    trait MyAlgebra[F[_]] {
      def doThing: F[Unit]
    
      def mapK[G[_]](fk: F ~> G): MyAlgebra[G]
    }
    // Let it be an expensive operation to construct an instance of MyAlgebra,
    // such that we only wish to construct it once.
    def make[F[_]](loc: Local[F, Auth]): MyAlgebra[F] = ???
    
    def processInput[F[_]](alg: MyAlgebra[F]) = ???
    // ...
    Context[F].allocated.flatMap{ loc =>
       val alg = make[F](loc)
    
       def runAuthedRequest(auth: Auth) =
         processInput[F](alg.mapK(loc.setK(auth)))
    
       startAuthedServer(runAuthedRequest)
    }
  2. abstract def monad: Monad[F]

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  9. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  10. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  11. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  12. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  14. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  15. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  16. def toString(): String
    Definition Classes
    AnyRef → Any
  17. def use[C, A](c: C)(f: (Local[F, C]) => F[A])(implicit sp: SourcePos): F[A]

    Within the scope of f, the use of Local is well defined.

    Within the scope of f, the use of Local is well defined.

    If you use this combinator like you would a cats.effect.Resource's use, your program will be safe.

  18. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  19. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  20. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from AnyRef

Inherited from Any

Ungrouped