trait WithProvide[F[_], G[_], C] extends Provide[F] with Lift[G, F]

Synonym for Provide with explicit C as Ctx and G as Lower for better type inference

Can be seen as transformation F[*] = C => G[*]

Linear Supertypes
Lift[G, F], Provide[F], ContextBase, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. WithProvide
  2. Lift
  3. Provide
  4. ContextBase
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. type Ctx = C
    Definition Classes
    WithProvideProvide
  2. type Lower[A] = G[A]

    Result effect type without any notion of context

    Result effect type without any notion of context

    Definition Classes
    WithProvideProvide

Abstract Value Members

  1. abstract def lift[A](la: Lower[A]): F[A]

    Converts context-unaware computation into contextual one by ignoring context

    Converts context-unaware computation into contextual one by ignoring context

    One can treat F[A] as function of type Ctx => Lower[A] so this method creates something like _ => la which has type Ctx => Lower[A]

    Definition Classes
    WithProvideLiftProvide
  2. abstract def runContext[A](fa: F[A])(ctx: Ctx): Lower[A]

    Runs fa providing ctx to it.

    Runs fa providing ctx to it.

    One can treat F as function of type Ctx => Lower[A] so this method applies it to ctx.

    fa

    Contextual computation

    returns

    Result of running fa and providing it context

    Definition Classes
    WithProvideProvide
    Example:
    1. Example of usage is to hide sensitive information across a part of service

       import tofu.syntax.context._
      
      case class UserContext( id: String, phoneNumber: String //very sensitive ) def hidePartOfPhoneNumber: String =>
      String = ???
      
      def contextualLogInfo[F[_]](message: String)(implicit hasUserContext: UserContext In F): F[Unit] = ??? //logs both
      message AND UserContext
      
      def program[F[_]: WithRun[*[_], G[_], UserContext], G[_]: Monad] = for { user <- obtainUserSomehow[G] logUser =
      contextualLogInfo[F](s"Successfully obtained user") _ <- runContext[F](logUser)(user.toContext) //G[Unit] } yield
      ()

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() @IntrinsicCandidate()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  8. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  9. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  10. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  11. def liftF: FunctionK[G, F]
    Definition Classes
    Lift
  12. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  14. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  15. def runContextK(ctx: Ctx): ~>[F, Lower]

    Same as runContext but higher-kinded.

    Same as runContext but higher-kinded.

    Definition Classes
    WithProvideProvide
    Example:
    1.  trait ProcessHandler[G[_]] { def mapK[M[_]](fk: G ~> M): ProcessHandler[M] = ??? //...other methods } type
        WithMyContext[F[_], A] = ReaderT[F, MyCtx, A] val contextualProcessHandler: ProcessHandler[IO WithMyContext *] =
        ???
      
      val processHandler: ProcessHandler[IO] = processHandler.mapK( WithProvide[IO WithMyContext *, IO,
      MyCtx].runContextK )
  16. def runExtract[A](extract: Extract[A, Ctx]): WithProvide[F, Lower, A]

    Allows to focus Provide on inner parts of its context with lens.

    Allows to focus Provide on inner parts of its context with lens.

    extract

    lens that can extract from Ctx value of type A

    Definition Classes
    WithProvideProvide
  17. def self: WithProvide[F, G, C]
    Definition Classes
    WithProvideProvide
  18. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  19. def toString(): String
    Definition Classes
    AnyRef → Any
  20. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  21. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  22. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from Lift[G, F]

Inherited from Provide[F]

Inherited from ContextBase

Inherited from AnyRef

Inherited from Any

Ungrouped