Created
February 14, 2013 07:43
-
-
Save tpolecat/4951184 to your computer and use it in GitHub Desktop.
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
object Tuples { | |
trait HT { | |
type H | |
type T | |
def hd: H | |
def tl: T | |
} | |
implicit class T3[A, B, C](t: (A, B, C)) extends HT { | |
type H = A | |
type T = (B, C) | |
def hd = t._1 | |
def tl = (t._2, t._3) | |
} | |
val tup = (1, "2", false) | |
val a: Int = tup.hd | |
val bc: (String, Boolean) = tup.tl | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment