Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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)
- }
Add Comment
Please, Sign In to add comment