Arithmetic functions should work with mixed Types
Summary: Currently, the _plus
, _minus
, _times
and _divideBy
functions only work if the parameters are the same Type. They really should work with any combination of numeric Types.
I started to implement this, and then dropped it for now because the code was coming out horrifyingly ugly. The problem is that the current Typeclass-based approach completely falls apart in this case. Need to pause and think about it more carefully.
I believe that, in principle, you want to widen the types to match -- Int becomes Long, either becomes Float -- and then do the computation.
In any case, the output of _divideBy should always be Float.