[Haskell-cafe] Where would I find fromInt?

Tom Harper rtharper at aftereternity.co.uk
Sun Sep 9 19:01:08 EDT 2007


Hi Paul --

The function you want is called fromIntegral, and works for all Integral types.

Using it, you can add a type signature to specify what you want to
change the number to (Float, Double, other Integral type, etc.

Example:

> fromIntegral (4 :: Int) :: Double
4.0

Hope this helps!

--
Tom Harper
rtharper at aftereternity.co.uk
+1 949 235 0185
Public Key: http://aftereternity.co.uk/rth.asc


On 9/9/07, PR Stanley <prstanley at ntlworld.com> wrote:
> Hi
> Where would I find the fromInt function, please?
> Better still, would anyone know how to write a func for converting
> int to float and vice versa?
> Thanks, Paul
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>


-- 
Tom Harper
rtharper at aftereternity.co.uk
+1 949 235 0185
Public Key: http://aftereternity.co.uk/rth.asc


More information about the Haskell-Cafe mailing list