On Tue, 8 Feb 2011, C K Kashyap wrote:

I need to convert IOArray to bytestring as shown below - 

import Data.Array.IO
import Data.Binary.Put
import qualified Data.ByteString.Lazy as BS
import Data.Word

main = do
arr <- newArray (0,9) 0 :: IO (IOArray Int Int)
let bs=toByteString arr
return ()

How can I implement the 'toByteString' function?

Why do you want to convert? If you process images you might consider one of the Vector libraries like storable-vector or vector. You can work on them in a mutable way, write them to disk, pass them to C libraries and so on.

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to