[Haskell-cafe] Help needed for converting IOArray to ByteString
illissius at gmail.com
Tue Feb 8 11:52:27 CET 2011
On Tue, Feb 8, 2011 at 10:39 AM, C K Kashyap <ckkashyap at gmail.com> wrote:
>> 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
> 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?
Using Data.ByteString.Internal.create along with readArray to fill in
the contents seems like it would be a fast option (though I haven't
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
Work is punishment for failing to procrastinate effectively.
More information about the Haskell-Cafe