unlift

object Function {
  def unlift[X, Y](f: (X) => Option[Y]): PartialFunction[X, Y]
}

unlift creates an anonymous partial function that returns the value extracted from Some returned by the function f.

If f returns None then the anonymous partial function will throw a MatchError exception.