
12 Nov
2006
12 Nov
'06
1:49 p.m.
How do people like to set up their foreign I/O functions to return ByteStrings? I was a little stumped over this yesterday evening, while trying to write ` recv :: Socket -> Int -> Int -> ByteString ' Doc says `Byte vectors are encoded as strict Word8 arrays of bytes, held in a ForeignPtr, and can be passed between C and Haskell with little effort.' Which sounds perfect - I'm always up for `little effort'! CString doesn't seem like the right thing for socket results, because the data shouldn't be NUL-terminated, and I might want to realloc when the returned data doesn't fill the buffer. I don't see any other Ptr-related function or constructor in the documentation - am I missing something there? Thanks, Donn Cave, donn@drizzle.com