
Folks, I'm putting together an FFI layer to a library which uses writev for its IO, and so expects an array of iovec structs as an argument to one of its calls. for more information, check out "man writev"[1]. Since I'm already using Data.Binary, the writev call almost sounds like a perfect match for lazy bytestrings, so I thought I'd put up what I have for comments. I'm using c2hs[2]. The recursive nesting of 'withForeignPtr' put me off at first, but I thought I'd at least give it a shot. I haven't put this into practice yet, so it could be buggy. I'm more looking for comments on the approach. Antoine [1] http://linux.die.net/man/3/writev [2] http://www.cse.unsw.edu.au/~chak/haskell/c2hs/ Foreign/IOVec.chs
-- -*-haskell-*-
module Foreign.IOVec
(IOVec()
,withLazyByteString
)
where
import C2HS
import qualified Data.ByteString as S
import qualified Data.ByteString.Internal as S
import qualified Data.ByteString.Lazy as L
#include