What's difference between Integer and Int?

Serguey Zefirov Serguey Zefirov <sz@uc.ru>
Tue, 19 Aug 2003 15:14:53 -0700


Hello glasgow-haskell-users,

The following program
-----------------------------------------------
--main = print (show (fibs!!200000))
main = print (show (nth 200000 fibs))

nth 0 (h:_) = h
nth n (h:t) = nth (n-1) t

fibs :: [Integer]
-- fibs = 1 : (map snd $ iterate (\(x,y) -> (y, x+y)) (1,1))
fibs = [1..]
-----------------------------------------------
compiled with ghc 6.0:

  ghc -O -o a.exe a.hs

does not execute correctly. It causes stack overflow in 1M stack.

If we change "fibs :: [Integer]" to "fibs :: [Int]" the new program
runs Ok. 


-- 
Best regards,
 Serguey                          mailto:sz@uc.ru