trait WithLocal[F[_], C] extends Local[F] with WithContext[F, C]

Synonym for Local with explicit C as Ctx for better type inference

Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. WithLocal
  2. WithContext
  3. Local
  4. Context
  5. ContextBase
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. type Ctx = C
    Definition Classes
    WithContextContext

Abstract Value Members

  1. abstract def context: F[Ctx]
    Definition Classes
    Context
  2. abstract def functor: Functor[F]
    Definition Classes
    Context
  3. abstract def local[A](fa: F[A])(project: (Ctx) ⇒ Ctx): F[A]

    Alters context for computation

    Alters context for computation

    fa

    computation that is going to run with different context

    project

    pure function

    returns

    result of ran computation fa

    Definition Classes
    WithLocalLocal
    Example:
    1. Example of usage is to hide sensitive information

       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[_]: Monad] = for { user <- obtainUserSomehow[F] implicit0(hasUserContext: In[User, F]) <-
      Context.const[F, User](user.toContext) logUser = contextualLogInfo[F](s"Successfully obtained user") _ <-
      logUser.local(hidePartOfPhoneNumber) //logs only part of phone number } 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 asWithContext: WithContext[F, C]
    Definition Classes
    WithContextContext
  6. def ask[A](f: (Ctx) ⇒ A): F[A]

    Returns context modified by pure function f.

    Returns context modified by pure function f.

    For example one can use it like that:

    Context[F].ask(myCtx => myCtx.toString)

    Also there is more convenient syntax:

    import tofu.syntax.context._
    
    ask[F](myCtx => myCtx.toString)
    Definition Classes
    WithContextContext
    Note

    It does not affect context itself.

  7. def askF[A](f: (Ctx) ⇒ F[A])(implicit F: FlatMap[F]): F[A]

    Same as ask but f is effectual

    Same as ask but f is effectual

    Definition Classes
    WithContextContext
  8. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native() @IntrinsicCandidate()
  9. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  11. def extract[A](extract: Extract[Ctx, A]): ContextExtractInstance[F, Ctx, A]

    Allows to focus context on its inside with lens.

    Allows to focus context on its inside with lens.

    extract

    lens that can extract value of type A from Ctx

    Definition Classes
    WithContextContext
  12. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  13. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  14. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  15. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  16. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  17. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  18. def subcontext[A](contains: Contains[Ctx, A]): WithLocal[F, A]

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

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

    contains

    lens that can extract from Ctx or set some value of type A

    Definition Classes
    WithLocalLocal
  19. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  20. def toString(): String
    Definition Classes
    AnyRef → Any
  21. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  23. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

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

Inherited from WithContext[F, C]

Inherited from Local[F]

Inherited from Context[F]

Inherited from ContextBase

Inherited from AnyRef

Inherited from Any

Ungrouped