I'm quite new to Scala but I already love it. I have read tutorials and articles on partial functions. What I would like to achieve is to have an object extending PartialFunction[...,...] and have it defined directly with cases, without needing to define isDefinedAt and apply methods.
For example
val partialfuncval : PartialFunction[Int,Boolean] = {
case 1 => false
}
is a valid definition of a partial function. But why can't I write
object PartialFunctionClass extends PartialFunction[Int,Boolean] {
case 1 => false
}
? This would cancel the need of defining isDefinedAt and apply and would make writing classes of certain (predefined by a lib I'm using) types easier.