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

Regards,
Kashyap