Listen

@implicitNotFound("Could not find an implicit instance of Listen[${F}, ${L}]. If you wish\nto capture side-channel output of type ${L} at this location, you may want\nto construct a value of type WriterT for this call-site, rather than ${F}.\nAn example type:\n\n WriterT[${F}, ${L}, *]\n\nOne use-case for this would be if ${L} represents an accumulation of values\nwhich are produced by this function *in addition to* its normal results.\nThis can be used to implement some forms of pure logging.\n\nIf you do not wish to capture a side-channel of type ${L} at this location,\nyou should add an implicit parameter of this type to your function. For\nexample:\n\n (implicit flisten: Listen[${F}, ${L}])\n") trait Listen[F[_], L] extends Tell[F, L] with Serializable

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[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)) }
}
Companion
object
trait Tell[F, L]
trait Serializable
class Object
trait Matchable
class Any
trait Censor[F, L]

Value members

Abstract methods

def listen[A](fa: F[A]): F[(A, L)]

Concrete methods

def listens[A, B](fa: F[A])(f: L => B): F[(A, B)]

Inherited methods

def functor: Functor[F]
Inherited from
Tell
def tell(l: L): F[Unit]
Inherited from
Tell
def tuple[A](ta: (L, A)): F[A]
Inherited from
Tell
def writer[A](a: A, l: L): F[A]
Inherited from
Tell