Skip to content

Instantly share code, notes, and snippets.

@yasuabe
Created December 23, 2017 17:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yasuabe/642887520a68b7305c68365101bf5119 to your computer and use it in GitHub Desktop.
Save yasuabe/642887520a68b7305c68365101bf5119 to your computer and use it in GitHub Desktop.
(A,A) =f=> (R,R) where f:A=>R
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