Why does Numeric treat unary differently to binary?
What's up with this?
import Numeric.Implicits._
def myAdd[T: Numeric](x: T, y: T) = x + y // Works
myAdd(1,2)
def myInc[T: Numeric](x: T) = x + 1 // Fails at x: could not find
implicit value for parameter num: scala.math.Numeric[Any]
myInc(9)
Scala 2.10
Something to do with x+1 --> Numeric+Int?
No comments:
Post a Comment