[Haskell-cafe] Can't explain this error

Andy Georges andy.georges at elis.ugent.be
Mon Jul 11 12:01:30 EDT 2005


				
On 11 Jul 2005, at 17:37, Dinh Tien Tuan Anh wrote:

> sumHam :: Integer -> Float
> sumHam n = sum [1/x | x<-[1..n]]
>
Try this:

sumHam :: Integer -> Float
sumHam n = sum [1.0/(fromIntegral x) | x<-[-1..n]]


-- Andy



More information about the Haskell-Cafe mailing list