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@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to