[Haskell-cafe] When is waitForProcess not necessary?

Dave Bayer bayer at math.columbia.edu
Thu Aug 2 23:52:53 EDT 2007


If one is calling runInteractiveCommand for a "sure-thing" returning a small
amount of output (say, "ls" for a modest directory"), is it necessary to call
waitForProcess?

My waitForProcess calls came under scrutiny when I tried to GHC profile a
threaded process, which isn't possible. It turns out that my programs run
faster if they don't call waitForProcess, and it sure seems empirically
that they never fail to run correctly. It would seem to me that in a lazy
language, later code wouldn't presume it was looking at an entire string
until the actual EOF came through, completing the string.

So at the end of a program, with nothing else to do but wait, why not wait
"implicitly" rather than via an explicit call to waitForProcess? What am I
missing?

(I've searched this forum; an interesting example is runCommand in


    http://happs.org/HAppS/src/HAppS/Util/Common.hs

but I'm asking why this isn't overkill in my scenario. I'm actually calling
Markdown.pl on tiny files (source code of lengths a human would read), and
it is certainly sluggish enough to be a fair test.)



More information about the Haskell-Cafe mailing list