daily pastebin goal
23%
SHARE
TWEET

Untitled

a guest Jan 14th, 2018 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
Top