[Haskell-cafe] Stack overflow while programming imperatively

Clark Gaebel cgaebel at csclub.uwaterloo.ca
Sun Mar 18 19:32:04 CET 2012

Hey list.

I was recently fixing a space leak by dropping down to imperative
programming in a section of my code, when it started developing space
leaks of its own.

I found the problem though - it was my "for loop": http://hpaste.org/65514

Can anyone provide suggestions on why that stack overflows? It seems
ridiculously tail recursive. I tried to do it more haskell-like with
http://hpaste.org/65517, but it was still spending 75% of its time in

Is there any way to write such a loop with ~100% productivity? I don't
think there should be _any_ garbage generated, as all values may be
stack allocated. Is this a performance regression in GHC?

  - clark

More information about the Haskell-Cafe mailing list