cats.mtl.Local
See theLocal companion object
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
Members list
In this article