[Haskell-cafe] Re: A guess on stack-overflows - thunks build-up and tail recursion

2009-03-21 Thread G?uenther Schmidt
Hi Bas, I'd like to share some thoughts with you. Let's say I'm unable, for whatever reason, to force full evaluation of the accumulator during a foldl. So I have this huge build up of thunks, which causes a stack overflow when the thunks are being reduced. I wonder if I could write some

[Haskell-cafe] Re: A guess on stack-overflows - thunks build-up and tail recursion

2009-03-20 Thread GüŸnther Schmidt
Thanks Bas and Ketil, the point I wanted to stress though is that the stack overflow does actually not occur doing the recursive algorithm, just a build-up of thunks. The algorithm itself will eventually complete without the stack overflow. The problem occurs when the result value is needed

Re: [Haskell-cafe] Re: A guess on stack-overflows - thunks build-up and tail recursion

2009-03-20 Thread Edsko de Vries
The problem occurs when the result value is needed and thus the thunks need to be reduced, starting with the outermost, which can't be reduced without reducing the next one etc and it's these reduction steps that are pushed on the stack until its size cause a stack-overflow. Yes,

[Haskell-cafe] Re: A guess on stack-overflows - thunks build-up and tail recursion

2009-03-20 Thread GŸuenther Schmidt
Thanks Bas and Ketil, the point I wanted to stress though is that the stack overflow does actually not occur doing the recursive algorithm, just a build-up of thunks. The algorithm itself will eventually complete without the stack overflow. The problem occurs when the result value is needed

Re: [Haskell-cafe] Re: A guess on stack-overflows - thunks build-up and tail recursion

2009-03-20 Thread Bas van Dijk
On Fri, Mar 20, 2009 at 2:01 PM, GüŸnther Schmidt gue.schm...@web.de wrote: The problem occurs when the result value is needed and thus the thunks need to be reduced, starting with the outermost, which can't be reduced without reducing the next one etc and it's these reduction steps that

Re: [Haskell-cafe] Re: A guess on stack-overflows - thunks build-up and tail recursion

2009-03-20 Thread Matthew Brecknell
GüŸnther Schmidt wrote: the point I wanted to stress though is that the stack overflow does actually not occur doing the recursive algorithm, just a build-up of thunks. You can also observe this with suitable trace statements. For example: import Debug.Trace import System.Environment

Re: [Haskell-cafe] Re: A guess on stack-overflows - thunks build-up and tail recursion

2009-03-20 Thread wren ng thornton
GüŸnther Schmidt wrote: the point I wanted to stress though is that the stack overflow does actually not occur doing the recursive algorithm, just a build-up of thunks. The algorithm itself will eventually complete without the stack overflow. The problem occurs when the result value is