[Haskell-cafe] about integer and float operations
Ross Mellgren
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
3.3333333333333335
That what you're looking for?
-Ross
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
> http://www.haskell.org/mailman/listinfo/haskell-cafe
More information about the Haskell-Cafe
mailing list