Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
A Bit More Generic Writer MOnad
case class Writer[A](value: A, diary: String) = {
def flatMap[B](f: A => Writer[B]) = {
f(value) match {
case Writer(result, d) => Writer(result, diary + d)
def map[B](f: A => B]) = Writer(f(value), diary)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.