System.Posix.IO.ByteString

Erik de Castro Lopo mle+hs at mega-nerd.com
Sun Jan 11 22:16:53 UTC 2015


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-IO-ByteString.html
> 
> 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/


More information about the Libraries mailing list