Scala Extractors
Scala’s extractors and unapply() represent a concept that I haven’t grok’ed until now.
Most demonstrations seem to be too long or use the same types everywhere. Here are my thoughts on the concept;
val a: C = ???
val i: I = ???
i match {
case a(f: O) =>
???
}
This will try to call the below method
class C {
def unapply(i: I): Option[O] =
???
}
There’s some more flexibility;