[Haskell-cafe] Forcing evaluation when seq or strictness annotation are not possible [was: guess on stack-overflows - thunks build-up and tail recursion]

Gü?nther Schmidt gue.schmidt at web.de
Fri Mar 20 11:08:14 EDT 2009


Hi all,

here I am again with my all time favorite unsolved problem: stack overflows.

The advice I have received so far from the Haskell community (this list 
and #haskell) was to use strictness annotation or seq in most cases.

And indeed it did help.

It certainly helped when I used a data structure that I designed myself 
and a filling routine that I also wrote myself, thanks guys (and girls 
possibly, I mean I don't know).

But sometimes neither of the 2 helps.

Especially when you are using a brilliantly designed data structure such 
as IxSet, from happstack, originally HAppS. Since it's someone else code 
it's too late to add strictness annotation. Or the "core" insert that 
you have to use in your filling routine is lazy.

In such cases you're just out of a luck.

I have read about alternatives to the above mentioned techniques, CPS, 
Codensity-Monad and this

http://wwwtcs.inf.tu-dresden.de/~voigt/mpc08.pdf

in Blogs, Wikis and Papers, also on this mailing list a post called 
"stupid question #852". Well when I say alternatives I mean I 
*perceived* these techniques to be *meant* as alternatives, as a way to 
control evaluation order, or *force* evaluation.

And this is my question: Am I barking up the wrong tree, is the purpose 
of these techniques actually not to force evaluation order?

Günther



More information about the Haskell-Cafe mailing list