cats.mtl
FunctorListen[F, L] is a function F[A] => F[(A, L)] which exposes some state that is contained in all F[A] values, and can be modified using tell.
FunctorListen[F, L]
F[A] => F[(A, L)]
F[A]
tell
FunctorListen has two external laws:
FunctorListen
def listenRespectsTell(l: L) = { listen(tell(l)) <-> tell(l).as(((), l)) } def listenAddsNoEffects(fa: F[A]) = { listen(fa).map(_._1) <-> fa }
FunctorListen has one internal law:
def listensIsListenThenMap(fa: F[A], f: L => B) = { listens(fa)(f) <-> listen(fa).map { case (a, l) => (a, f(l)) } }
FunctorListen[F, L]
is a functionF[A] => F[(A, L)]
which exposes some state that is contained in allF[A]
values, and can be modified usingtell
.FunctorListen
has two external laws:FunctorListen
has one internal law: