
11 Jan
2015
11 Jan
'15
10:16 p.m.
Antoine Latter wrote:
The 'unix-bytestring' package looks like it can read a ByteString from the file descriptor once you have it open:
http://hackage.haskell.org/package/unix-bytestring-0.3.7.2/docs/System-Posix...
Sadly both 'unix' and 'unix-bytestring' define a module named 'System.Posix.IO.ByteString', and you need functionality from both to get your job done - 'openFd' from 'unix' and then 'fdRead' from 'unix-bytestring'.
Ah, thanks for that. In the end, I ended up using `fdReadBuf` to read the data into a buffer, followed by `unsafePackCStringFinalizer` to get a ByteString. Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/