I see this method in scala List.sum
sum[B >: A](implicit num: Numeric[B]): B
I now understand that he expects that any argument numwill be implicitly converted to Numeric[B], which means its value typeclass Numeric. However, I don’t understand what it is Aif it doesn’t reference it at all.
return value B
and implementation
foldLeft(num.zero)(num.plus)
and numalso have a type Numeric[B], therefore, if the return value does not apply to A, and the implementation does not apply to A, why is this necessary?
source
share