Local

cats.mtl.Local
See theLocal companion object
trait Local[F[_], E] extends Ask[F, E], Serializable

Local[F, E] lets you alter the E value that is observed by an F[A] value using ask; the modification can only be observed from within that F[A] value.

Local[F, E] has three external laws:

def askReflectsLocal(f: E => E) = {
 local(f)(ask) <-> ask map f
}

def localPureIsPure[A](a: A, f: E => E) = {
 local(f)(pure(a)) <-> pure(a)
}

def localDistributesOverAp[A, B](fa: F[A], ff: F[A => B], f: E => E) = {
 local(f)(ff ap fa) <-> local(f)(ff) ap local(f)(fa)
}

Local has one internal law:

def scopeIsLocalConst(fa: F[A], e: E) = {
 scope(e)(fa) <-> local(_ => e)(fa)
}

Attributes

Companion
object
Source
Local.scala
Graph
Supertypes
trait Ask[F, E]
trait Serializable
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def local[A](fa: F[A])(f: E => E): F[A]

Attributes

Source
Local.scala

Concrete methods

def scope[A](fa: F[A])(e: E): F[A]

Attributes

Source
Local.scala

Inherited methods

Attributes

Inherited from:
Ask
Source
Ask.scala
def ask[E2 >: E]: F[E2]

Attributes

Inherited from:
Ask
Source
Ask.scala
def reader[A](f: E => A): F[A]

Attributes

Inherited from:
Ask
Source
Ask.scala