Is there any way, to get to the type of A
from Some[A]
?
type X = Some[Int]
type Y = ??? // what do I have to write here to get `Int`
I can define my own Option
-type that allows this:
sealed trait Option[+A]
case object None extends Option[Nothing]
case class Some[+A](a: A) {
type Inner = A
}
and then use
type X = Some[Int]
type Y = X#Inner
Is this also possible somehow with the normal Scala Option type?