Skip to content

Instantly share code, notes, and snippets.

@bjornharrtell
Created August 15, 2012 20:40
Show Gist options
  • Save bjornharrtell/3363423 to your computer and use it in GitHub Desktop.
Save bjornharrtell/3363423 to your computer and use it in GitHub Desktop.
Trying to understand this...
trait POf2[Bi[_, _]] {
def unapply[A, B](x: Bi[A, B]): Option[(A, B)]
}
implicit val TuplePOf2: POf2[Tuple2] = new POf2[Tuple2] {
def unapply[A, B](x: (A, B)) = Some(x)
}
(1, 4) match { case TuplePOf2(a, b) => a + b }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment