[Haskell-cafe] ANN: network-socket-options 0.1

Joey Adams joeyadams3.14159 at gmail.com
Tue Feb 21 07:57:07 CET 2012


I added a new package containing wrappers for getsockopt and setsockopt:

    http://hackage.haskell.org/package/network-socket-options

The network package already has getSocketOption and setSocketOption.
The problem is, these don't work for socket options that aren't
represented by integers, such as SO_LINGER:

    http://trac.haskell.org/network/ticket/23

Another, less serious problem is that getSocketOption and
setSocketOption don't leverage the type system as well as they could.
Many options are boolean values; it'd be better to get and set them
with 'Bool's instead of 'Int's.

network-socket-options implements options using getter and setter
functions, e.g.:

    getLinger :: HasSocket sock => sock -> IO (Maybe Seconds)

    setLinger :: HasSocket sock => sock -> Maybe Seconds -> IO ()

    type Seconds = Int

The HasSocket type class is defined to overload the getters and
setters to work on raw file descriptors, not just Socket objects.

This functionality should probably go in the network package itself.
However, I decided to release it as a separate package so I could
start using it sooner.  If people like it enough, perhaps the network
package can absorb it, as was done with network-bytestring.

-Joey Adams



More information about the Haskell-Cafe mailing list