Function definition of the PartialFunction is following:
trait PartialFunction[-A, +B] extends (A) ⇒ B
PartialFunction would allow us to filter by using case with collect on collection.
For example when you have list of integers and PartialFunction isEven[Int, String] which will convert to String if the value in the collection is even number. So it returns a new collection with the return type +Bin the definition.
My question is, why contravariant -A and covariance +B? It basically has ability to accept any input to any output. Why do we need to indicate the input should be a any type or super type of a type A and return type should be B or its subclass? Can't we just say:
trait PartialFunction[A, B]