Re: [Haskell-cafe] Re: Coming up with a better API for Network.Socket.recv

2009-02-28 Thread Brandon S. Allbery KF8NH
On 2009 Feb 27, at 4:25, Colin Paul Adams wrote: Anyway, the POSIX spec indicates the EOF condition as return -1 with errno == ECONNRESET; this should not be taken as anything but the limited expressiveness of a C-based API. We should map this return to Nothing. Johan I'm not sure I

Re: [Haskell-cafe] Re: Coming up with a better API for Network.Socket.recv

2009-02-27 Thread Johan Tibell
On Fri, Feb 27, 2009 at 12:07 AM, Achim Schneider bars...@web.de wrote: Bryan O'Sullivan b...@serpentine.com wrote: There's another problem with the network APIs: they mirror the BSD socket API too faithfully, and provide insufficient type safety. You can try to send on an unconnected socket,

Re: [Haskell-cafe] Re: Coming up with a better API for Network.Socket.recv

2009-02-27 Thread Johan Tibell
2009/2/27 Brandon S. Allbery KF8NH allb...@ece.cmu.edu: On 2009 Feb 26, at 23:41, Achim Schneider wrote: Brandon S. Allbery KF8NH allb...@ece.cmu.edu wrote: On 2009 Feb 26, at 16:45, Johan Tibell wrote: Anyway, the reason recv doesn't return 0 is that if you have a datagram socket, a

Re: [Haskell-cafe] Re: Coming up with a better API for Network.Socket.recv

2009-02-27 Thread Colin Paul Adams
Anyway, the POSIX spec indicates the EOF condition as return -1 with errno == ECONNRESET; this should not be taken as anything but the limited expressiveness of a C-based API.  We should map this return to Nothing. Johan I'm not sure I agree. I think using exceptions in this case is fine as

Re: [Haskell-cafe] Re: Coming up with a better API for Network.Socket.recv

2009-02-26 Thread Brandon S. Allbery KF8NH
On 2009 Feb 26, at 23:41, Achim Schneider wrote: Brandon S. Allbery KF8NH allb...@ece.cmu.edu wrote: On 2009 Feb 26, at 16:45, Johan Tibell wrote: definition of `recv` would look like. My current thinking is that it would mimic what C/Python/Java does and return a zero length ByteString when