AW: [Haskell] Hugs Nov2003 X Nov2002

Markus.Schnell at Markus.Schnell at
Tue Mar 16 13:55:23 EST 2004

fromInt = fromInteger . toInteger

Markus Schnell 

-----Ursprüngliche Nachricht-----
Von: haskell-bounces at [mailto:haskell-bounces at] Im
Auftrag von Stenio
Gesendet: Dienstag, 16. März 2004 10:29
An: Ketil Malde
Cc: haskell at
Betreff: Re: [Haskell] Hugs Nov2003 X Nov2002

fromInteger works, but it converts from Integer to Float. In my script, I
need fromInt because it converts from Int to Float.


average :: Int -> Float
average n = fromInt ( sum n ) :: Float / fromInt n :: Float

It works only in Hugs November 2002


--------- Mensagem Original --------
De: "Ketil Malde" <ketil+haskell at>
Para: "Stenio" <stenio at>
Cópia: haskell at
Assunto: Re: [Haskell] Hugs Nov2003 X Nov2002
Data: 16/03/04 12:07

"Stenio" <stenio at> writes:

> I was using Hugs November 2002 and the function fromInt works fine,
> but in the version November 2003 the same function doesn´t work.

I'm too lazy to check the standard, so I'll just assume Hugs was
wrong. I think the solution is to use "fromIntegral" instead. GHCi
also has "fromInteger", although I'm not quite sure why we need this
in addition to "fromIntegral"? (Possibly because it is a member of
Num, and it would break too much code to remove it)

If I haven't seen further, it is by standing in the footprints of giants

-------------- next part --------------
An HTML attachment was scrubbed...

More information about the Haskell mailing list