4 ms·
Yes. I wrongly remembered (and even checked the out-of-the-box output of ":i Fractional"!) that it doesn't include Rational, but only different flavours of floa
by owl57 7y ago
Yes. I wrongly remembered (and even checked the out-of-the-box output of ":i Fractional"!) that it doesn't include Rational, but only different flavours of floats. The original point stands: Python's Fraction defines arithmetical operators in the same sane way, and the bespoke money type is about as free as in Haskell to define them in whatever way seems useful, like throwing exceptions on adding dollars to euros.
(And also throwing exceptions on adding dollars to generic ints — that one would be a compile-time error in Haskell, which is of course a good thing. Is this not only a good thing but a critical one in financial context?)