3 ms·
Unfortunately, "Num" isn't precisely what you want in money - you don't multiply dollars by dollars to get dollars... But it works well enough.
by dllthomas 14y ago
Unfortunately, "Num" isn't precisely what you want in money - you don't multiply dollars by dollars to get dollars...
But it works well enough.
- jrockway 14y agoRather than arbitrary multiplication, you should probably have an OrderUnits type, then define a function of type Money -> OrderUnits -> Money that calculates the price of multiple units. (Money 3 * 2 will return Money 6 if fromIntegral 2 = Money 2. But that is not really the operation you want to perform, so you might consider not implementing Num for Money.)
- dllthomas 14y agoRight, exactly.