Cats Api Documentation

Version: 1.2.0

cats.labs.writer

The Writer Monad.

listen

(listen mv)

Get the value from the log.

MonadWriter

protocol

A specific case of Monad abstraction that allows emulate write operations in pure functional way.

A great example is writing a log message.

members

-listen

(-listen m mv)

Given a writer, yield a (value, log) pair as a value.

-pass

(-pass m mv)

Given a writer whose value is a pair with a function as its second element, yield a writer which has the first element of the pair as the value and the result of applying the aforementioned function to the log as the new log.

-tell

(-tell m v)

Add the given value to the log.

pass

(pass mv)

Apply a function to the log.

tell

(tell v)

Add the value to the log.

writer

(writer f)

The Writer type constructor.

The purpose of Writer type is wrap a simple function that fullfill the writer signature.

It exists just for avoid extend the clojure function type because is very generic type.

writer-t

(writer-t inner-context)

The Writer transformer constructor.

writer?

(writer? s)

Return true if s is instance of Writer type.