Haskell threads & pipes & UNIX processes

Julian Seward (Intl Vendor) v-julsew@microsoft.com
Thu, 15 Feb 2001 08:50:41 -0800

| So what's going on? How can the goal be achieved?

I don't know, but here's a different suggestion, using
bzip2 (you could do the same with zlib for .gz files):
use the foreign import mechanism to make BZ2_bzopen,
BZ2_bzwrite and BZ2_bzclose available in your program.


   do bz2 <- bzopen "output.bz2" "w"

      let chars_to_write =3D ...  :: String
      bzwrite bz2 (packString chars_to_write) (length chars_to_write)
      -- the above as many times as you like

      bzclose bz2

and link your program with libbz2.a or libbz2.so.

Almost the same trick works with the zlib library for=20
directly reading/writing .gz files.

This strikes me as far more convenient than messing round
with pipes, etc.