[Haskell-cafe] about integer and float operations
rmm-haskell at z.odi.ac
Wed Feb 4 16:26:52 EST 2009
Prelude> let i2fDiv a b = fromIntegral a / fromIntegral b
Prelude> :t i2fDiv
i2fDiv :: (Integral a, Fractional b, Integral a1) =>
a -> a1 -> b
Prelude> 10 `i2fDiv` 3
That what you're looking for?
On Feb 4, 2009, at 4:22 PM, Manlio Perillo wrote:
> Manlio Perillo ha scritto:
>> I personally prefer the Python solution, where we have two
>> operators with the same behaviour over all the numbers.
>> In Haskell, something like
>> (/) :: (Num a, Real b) => a -> a -> b
> This should be
> (/) :: (Num a, Fractional b) => a -> a -> b
> but I'm not sure it is correct.
>> (//) :: (Num a, Integral b) => a -> a -> b
> Manlio Perillo
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe