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:[EMAIL PROTECTED]

_______________________________________________
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to