Scala Typing: How to Ensure Numeric Type -


I have a small problem in Scala with a typing case. In Haskell, I can do this:

  add :: (name) = & gt; (A, A) - & gt; (A, A) - & gt; (A, A)   

In this way, I can put in any type of number and I support + etc. I want to do this for a Scala class like:

  Case class numeracy [a & lt;: numeric] (x: A, y: a)   

but this does not seem to work, but due to scala docs, numeric [t] is the only feature that allows for these functions, and int , float etc.

  case class numpere [a]  numerical [ A])   

numerical example to itself int , float , etc., but this is a fixed object Has been provided as. For a long explanation, see.

Comments