I know this question may be answered a lot of times, however I cannot find a post that can solve my question. My question is I want to write a generic function that can take Int, Double or BigDecimal and do the calculation.
def foo[T: Numeric](returns: Seq[T])(implicit ev: T => Ordered[T]): Seq[T]= {
returns.filter(_ >= 0)
}
However I got a Type Match error, because 0 is a Int. If there any way that can make it work for any Numeric type.