
5 Dec
2000
5 Dec
'00
3:27 p.m.
Christian Lescher writes:
When defining expressions with arithmetic operations on a mixture of Integers and Floats (except literals), an explicit conversion by "fromIntegral" for the Integers is necessary, for example: ceiling (fromIntegral n / x)
Is it possible to do the "fromInteger" conversion automatically? What's the best way to do it? (overloading of operators, etc.?)
Hi. One complication is that some Integer values exceed the greatest Double value. In such cases, it's not clear which implementation of (/) should be used. It would certainly be nice to have an automatic conversion if, for example, n were an Int and x were a Float, because those types are both subsumed by Double. Regards, Tom