下面的代码: object Test {
@inline def unapply(i: Int): Option[String] =
i match {
case 1 => Some("Got 1")
case 2 => Some("Got 2")
case 3 => throw new Exception("Should not test
是否有一个方便的提取器,它是->运算符的反射(在数学意义上)? 例如,这个工程: scala> val y = 1 -> 2 -> 3
y: ((Int, Int), Int) = ((1,2),3)
scala> y match { case ((a,b),c) => s"Values are : $a, $b, and $c" }
res0: String = Values are :