[Haskell-cafe] Re: Using Haskell's FFI to send ancillary data over Unix domain sockets

Maurí­cio CA mauricio.antunes at gmail.com
Fri Mar 5 17:37:32 EST 2010


 > For me, this presents a few problems. I don't know where to get
 > the SCM_CREDENTIALS constant, I have no idea what flags to use
 > (does the Network module help with that?), I don't know how to
 > get from a list of file descriptors or a tuple to a Ptr, and
 > perhaps most importantly, I have no idea how to get the lengths
 > of pid_t, uid_t, gid_t, and socklen_t.

The basic answer is that you can use tools like hsc2hs, c2hs or
greencard.

I also wrote this package that may be of help:

   http://hackage.haskell.org/package/bindings-posix

You may want to look at the source code to see how to apply the
idea to your needs. Note that this package uses a lot of macros
I wrote myself (see package bindings-DSL), so you should not use
them if you want to stick with standard tools.

Best,

Maurício



More information about the Haskell-Cafe mailing list