[Haskell-cafe] Help needed for converting IOArray to ByteString

C K Kashyap ckkashyap at gmail.com
Tue Feb 8 10:39:00 CET 2011

> 1) Just use Data.Word.Word8 instead of the second Int in your type sig
> for IOArray
> 2) Use getElems to get a [Word8]
> 3) Data.ByteString.pack converts a [Word8] into a ByteString
> Michael

I am currently using a list of tuples - [(Int,Int,Int)] to represent an
image buffer. You can see it in the getImageByteString
function at https://github.com/ckkashyap/Chitra/blob/master/RFB/Encoding.hs
Looks like this is pretty slow, and hence I am exploring Arrays.

I wonder if working with [Word8] will also suffer from performance hit?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110208/94943df1/attachment.htm>

More information about the Haskell-Cafe mailing list