[Haskell-cafe] hGetLine problem

Jules Bean jules at jellybean.co.uk
Fri Dec 10 02:57:22 EST 2004


On 10 Dec 2004, at 06:28, Michael Walter wrote:

> Yep - this program "sometimes" fails for me with such an error message:
>
>   Fail: <socket: 8>: hGetLine: invalid argument (Invalid argument)
>

The underlying C library function 'accept' doesn't always return a 
socket. Sometimes it returns '-1' if something went wrong, or if there 
weren't any connections to accept and the handle was non-blocking.

I could well imagine that if hGetLine was passed a Handle which was -1 
it would give invalid argument, so this is a workable hypothesis. Of 
course, I'd expect the implementation of haskell accept to throw an 
exception in this case, but maybe it doesn't?

Jules



More information about the Haskell-Cafe mailing list