Hi,
I was trying to put a String in a ByteString

import qualified Data.ByteString.Lazy as BS
message :: BS.ByteString
message = runPut $ do
                                  let string="SOME STRING"
                                  map (putWord8.fromIntegral.ord)
string  -- this ofcourse generates [Put]

How can I convert the list of Put's such that it could be used in the Put monad?

For now I used the workaround of first converting the string to
ByteString like this -

stringToByteString :: String -> BS.ByteString
stringToByteString str = BS.pack (map (fromIntegral.ord) str)

and then using putLazyByteString inside the Put monad.

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

Reply via email to