Guest User

Untitled

a guest
Jan 14th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. case class Writer[A](value: A, diary: String) = {
  2. def flatMap[B](f: A => Writer[B]) = {
  3. f(value) match {
  4. case Writer(result, d) => Writer(result, diary + d)
  5. }
  6. }
  7. def map[B](f: A => B]) = Writer(f(value), diary)
  8. }
Add Comment
Please, Sign In to add comment