stack overflow

Scott Turner
Mon, 26 Feb 2001 09:38:36 -0500

At 01:26 2001-02-26 -0800, Simon Peyton-Jones wrote:
>And so on.  So we build up a giant chain of thunks.
>Finally we evaluate the giant chain, and that builds up
>a giant stack.
> ...
>If GHC were to inline foldl more vigorously, this would [not] happen.

I'd hate to have my programs rely on implementation-dependent optimizations.

BTW, I've wondered why the Prelude provides foldl, which commonly leads to
this trap, and does not provide the strict variant foldl', which is useful
enough that it's defined internal to the Hugs prelude.  Simple prejudice
against strictness?

Scott Turner