When pattern matching case classes how do you actually refer to the class which it was matched to?
Here's an example to show what I mean:
sealed trait Value
case class A(n: Int) extends Value
v match {
case A(x) =>
doSomething(A);
}
Where v
is of type value and doSomething
takes an parameter of type A
, not Value
.