after I learned that case classes extend Product, I wondered why they do not extend ProductN. E.g., given a code like:
case class Foo(a: Int)
I'd expect Foo(1).asInstanceOf[Product1[Int]]
to work, but it does not (checked with Scala 2.9.1, and confirmed by other sources and by Product
documentation).
I was interested in this, because I wanted to declare classes such as:
abstract class UnaryOp[T1 <: Exp[_], R](t1: T1) extends Exp[R] {
this: Product1[T1] =>
}
This way, a node for a Unary operation must be implement Product1. It would be nice if being simply a case class with one parameter would be enough for this.