sum[1..100000] --> stack overflow in GHC, but not in Hugs?

Jason Dagit dagit at codersbase.com
Sun Nov 23 09:16:53 EST 2008


On Sun, Nov 23, 2008 at 6:07 AM, Vishal Belsare <shoot.spam at gmail.com>wrote:

> Hi,
>
> Please bear with a very basic question. I am trying to 'learn me a
> Haskell for great good' using Hutton's book and some online tutorials.
> I started off with Hugs and recently used GHC (to use the 'let a  =
> ." syntax interactively, which Hugs doesn't allow perhaps).


You might also learn you a haskell for great good with:
http://learnyouahaskell.com


>
>
> There's a simple issue I am having with GHC. sum[1..100000] works fine
> on Hugs, however, the same in GHCi generates a stack overflow
> exception. I am trying to figure out what's going on.


You might try telling ghci to use optimizations.  I but that will fix this
problem.  I can't reproduce your stack overflow locally (I even tried with
bigger numbers).  But, this might help:
ghci -O

then try your code.

Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20081123/f85b8363/attachment.htm


More information about the Glasgow-haskell-users mailing list