cats.mtl.Listen
See theListen companion object
Listen[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
.
Listen
has two external laws:
def listenRespectsTell(l: L) = {
listen(tell(l)) <-> tell(l).as(((), l))
}
def listenAddsNoEffects(fa: F[A]) = {
listen(fa).map(_._1) <-> fa
}
Listen
has one internal law:
def listensIsListenThenMap(fa: F[A], f: L => B) = {
listens(fa)(f) <-> listen(fa).map { case (a, l) => (a, f(l)) }
}
Attributes
- Companion
- object
- Source
- Listen.scala
- Graph
-
- Supertypes
- Known subtypes
-
Members list
In this article