Open michaelahlers opened 10 months ago
Money is probably a poor example here. It's most likely not a scalar value (there'll be a unit [a currency] associated). And it doesn't always make sense to divide and multiply monetary amounts to obtain the like.
In place of methods and ad hoc extension methods, remember that type classes solve this problem elegantly and unlock worlds of functionality thanks to this form of ad hoc polymorphism.
Don't do this:
Or this:
Do this:
And reap the rewards of an existing ecosystem of functionality (provided, for example, by types like
Ordering[A]
).