Skip to content

Instantly share code, notes, and snippets.

@tpolecat
Created February 14, 2013 07:43
Show Gist options
  • Save tpolecat/4951184 to your computer and use it in GitHub Desktop.
Save tpolecat/4951184 to your computer and use it in GitHub Desktop.
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