Eliminating #ifdefs in fptools/libraries?

Ross Paterson ross@soi.city.ac.uk
Wed, 19 Mar 2003 10:01:38 +0000

[moving from private mail to cvs-hugs -- hope that's OK, Volker]

On Wed, Mar 19, 2003 at 10:22:28AM +0100, Volker Stolz wrote:
> The new libraries branch contains a bunch of
> #ifdef's for Hugs around calls to threadWait{Read,Write},
> especially in the network stuff.

You mean Network.Socket?  The problems seem to be
GHC.Posix.setNonBlockingFD, threadWait{Read,Write} and

> Could you add those functions as NOPs to Hugs' ConcBase?
> That way, the code base might clean up a bit...

I sympathize with your concern, but I'm a bit reluctant to have Hugs
pretending to provide things that it really doesn't handle.  (For example,
I think Hugs should stop pretending that it offers unsafeInterleaveIO.
There are dummy implementations of block and unblock, but they're correct
because Hugs doesn't throw asynchronous exceptions.)  I think it's better
to make programmers explicitly aware of such shortcomings rather that
let their programs compile and then not work.

How about abstracting the problematic bits in Network.Socket as functions
wrapped in #ifdef __HUGS__, but inside that module?

That said, Hugs probably could implement threadWait{Read,Write}, at least
on Posix and Win32 systems, but it probably won't happen for a while.