Created
December 23, 2017 17:19
-
-
Save yasuabe/642887520a68b7305c68365101bf5119 to your computer and use it in GitHub Desktop.
(A,A) =f=> (R,R) where f:A=>R
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package object ex01 { | |
implicit class T2mapper[A](val t: (A, A)) extends AnyVal { | |
def map[R](f: A => R): (R, R) = (f(t._1), f(t._2)) | |
def foldMap[R, B](f: A => R, g: (R, R) => B): B = g.tupled(t map f) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment