[Haskell-cafe] ByteString FFI

Donn Cave donn at drizzle.com
Sun Nov 12 13:49:28 EST 2006

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,
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?


	Donn Cave, donn at drizzle.com

More information about the Haskell-Cafe mailing list