| Yes, using lots of stack is clearly bad with ghc, but this is a ghc
| "bug". In fact the only reason these programs do use lots of stack
| (vs. heap) is just a peculiarity of ghc rts implementation, so it
| really should be ghc that fixes the problem, or at least admits
| responsibility :-)

I don't think there's anything fundamental here. GHC allocates the stack in the 
heap, and it can grow as big as you like.  The size limit is simply to catch 
infinite recursion with a more helpful message than "heap overflow".  I think.  
There is one peculiarity though: I don't think we ever shrink the stack, so 
once it gets big it stays big.  This could be fixed, though.

In short, feel free to set a very big max-stack size.  If you are going to grow 
a stack of size N or a heap-allocated list of size N, the stack version will 
probably be more efficient -- with the caveat about deallocation that I 
mentioned.

Simon
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to