2 Mar
2003
2 Mar
'03
11:28 a.m.
"Mike T. Machenry" <dskippy@ccs.neu.edu> writes:
I recently desided I wanted a bunch function to return float instead of Int. [...] I found fromInteger but it didn't seem to work on the return value of the cardinality function for instance.
Try fromIntegral, which works for Int and Integer, too.
Casting an Integral value to a Fractional value to perform arithmetic operations, is a very common need and I don't like adding fromIntegral everywhere, so ended up writing a (very simple) module with generalized arithmetic operators (see attachment). The » next to the operations indicate a cast from an Integral to a Fractional value. J.A.