Closed
Description
I'm confused by the following compile-time error:
private def safeMax[A](xs: List[A])(implicit ev: Ordering[A]): Option[A] =
xs match {
case ys@(_ :: _) => Some(ys.min)
case Nil => None
}
// Exiting paste mode, now interpreting.
<console>:12: error: No implicit Ordering defined for ?A1.
case ys@(_ :: _) => Some(ys.min)
^
I'm not sure if it's a bug, but it seemed suspect to me.
EDIT - I first posted this question on StackOverflow - http://stackoverflow.com/questions/38775071/no-implicit-ordering-defined-on-pattern-matched-list.