Re: [Haskell-cafe] ByteString FFI

2006-11-12 Thread Donald Bruce Stewart
donn: > On Mon, 13 Nov 2006, Donald Bruce Stewart wrote: > > > And for custom data (not just C strings), if the withCString* functions > > don't quite fit, you can always pack the foreign Ptr into a ByteString > > by stepping inside the ByteString constructor: > > > > http://www.haskell.org/h

Re: [Haskell-cafe] ByteString FFI

2006-11-12 Thread Donn Cave
On Mon, 13 Nov 2006, Donald Bruce Stewart wrote: > And for custom data (not just C strings), if the withCString* functions > don't quite fit, you can always pack the foreign Ptr into a ByteString > by stepping inside the ByteString constructor: > > http://www.haskell.org/haskellwiki/Wc#Going_

Re: [Haskell-cafe] ByteString FFI

2006-11-12 Thread Donald Bruce Stewart
donn: > 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

Re: [Haskell-cafe] ByteString FFI

2006-11-12 Thread Duncan Coutts
On Sun, 2006-11-12 at 10:49 -0800, Donn Cave wrote: > 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

[Haskell-cafe] ByteString FFI

2006-11-12 Thread Donn Cave
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 ca