daily pastebin goal
75%
SHARE
TWEET

Untitled

a guest Jan 14th, 2018 52 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
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top