[Haskell-cafe] Building "production stable" software in Haskell
jgbailey at gmail.com
Tue Sep 11 11:39:05 EDT 2007
On 9/11/07, Peter Verswyvelen <bf3 at telenet.be> wrote:
> How well and how can a Haskell program be tested to make sure it does
> not cause these space/time bugs? What tools are typically used?
I've been fighting this myself. I had an especially nasty
stack-overflow that took me weeks to track down. Of course, when I
did, I used the tried-and-true divide-and-conquer approach. I found a
case where my program consistently crashed, then I added output to see
what was executed just before hand (luckily I was already in the IO
monad). Finally, I wrote a test program that crashed the same way and
was able to fix the bug. ANd, of course, it turned out to be my usage
of foldr' - which is what I should have focused on first. Oh well.
As for memory usage, I've been using the heap profiling tools in GHC
quite a bit. They are scary at first, because they require you to
compare postscript graphs, but once you spend some time with them they
are actually very useful.
This article describes an early version of the tools in GHC:
And a web search using "Heap profiling for space efficiency in
functional programs" gives some nice results.
More information about the Haskell-Cafe