Is it possible to create an Extractor object that can be used such as:
val x = 42
x match {
case GreaterThan(80) => println("5")
case GreaterThan(70) => println("4")
case GreaterThan(60) => println("3")
case GreaterThan(40) => println("2")
case _ => println("1")
}
Now I do know that it is possible with if constructs, but I feel that it clutters my code (and seems redundant to do: case MyMatcher(x) if MyCreteria(x) => _
), and I want to avoid that.