
I need the trick to get from ByteString -> [GHC.Word.Word8] and Hayoo is not helping. Super simple I expected. I haven't even tried to compile it yet. I am just trying to read in the bytes and encode with base64: import Codec.Binary.Base64 import Data.ByteString import System.Directory import System.Environment main :: do args <- getArgs bFileExist <- System.Directory.doesFileExist (args !! 0) let bytedata = --ByteString -> [GHC.Word.Word8] if bFileExist then putStrLn $ Codec.Binary.Base64.encode bytedata else putStrlLn ("File does not exist: " ++ (args !! 0)) return ()

On Wed, Sep 29, 2010 at 11:03 AM, Roderick Ford
I need the trick to get from ByteString -> [GHC.Word.Word8] and Hayoo is not helping.
Super simple I expected. I haven't even tried to compile it yet. I am just trying to read in the bytes and encode with base64:
import Codec.Binary.Base64 import Data.ByteString import System.Directory import System.Environment main :: do args <- getArgs bFileExist <- System.Directory.doesFileExist (args !! 0) let bytedata = --ByteString -> [GHC.Word.Word8] if bFileExist then putStrLn $ Codec.Binary.Base64.encode bytedata else putStrlLn ("File does not exist: " ++ (args !! 0)) return ()
Does 'unpack' do what you want? Antoine

YES!! Thank you so much. And thanks to Thomas also for the suggestion of using Data.ByteString.Base64 ... as the alternative method. Cheers, Roderick
Date: Wed, 29 Sep 2010 11:11:01 -0500 Subject: Re: [Haskell-cafe] can't find in hayoo From: aslatter@gmail.com To: developer@live.com CC: haskell-cafe@haskell.org
On Wed, Sep 29, 2010 at 11:03 AM, Roderick Ford
wrote: I need the trick to get from ByteString -> [GHC.Word.Word8] and Hayoo is not helping.
Super simple I expected. I haven't even tried to compile it yet. I am just trying to read in the bytes and encode with base64:
import Codec.Binary.Base64 import Data.ByteString import System.Directory import System.Environment main :: do args <- getArgs bFileExist <- System.Directory.doesFileExist (args !! 0) let bytedata = --ByteString -> [GHC.Word.Word8] if bFileExist then putStrLn $ Codec.Binary.Base64.encode bytedata else putStrlLn ("File does not exist: " ++ (args !! 0)) return ()
Does 'unpack' do what you want?
Antoine

By and large hayoo is the alta-vista of Haskell search - it has a huge
database but isn't well organized or good at prioritizing. Use Hoogle
when doing type-based searches for functions in the typical GHC load.
http://haskell.org/hoogle/?hoogle=%3A%3A+ByteString+-%3E+[Word8]
Also, what's with the non-standard module specification
"GHC.Word.Word8"? You should use Data.Word.
Cheers,
Thomas
On Wed, Sep 29, 2010 at 9:03 AM, Roderick Ford
ByteString -> [GHC.Word.Word8]

The idea was to go from Prelude> :t Data.ByteString.readFile Data.ByteString.readFile :: FilePath -> IO Data.ByteString.Internal.ByteString to here Prelude> :t Codec.Binary.Base64.encode Codec.Binary.Base64.encode :: [GHC.Word.Word8] -> String unless there is another/easier way???? Roderick
Date: Wed, 29 Sep 2010 09:23:37 -0700 Subject: Re: [Haskell-cafe] can't find in hayoo From: thomas.dubuisson@gmail.com To: developer@live.com CC: haskell-cafe@haskell.org
By and large hayoo is the alta-vista of Haskell search - it has a huge database but isn't well organized or good at prioritizing. Use Hoogle when doing type-based searches for functions in the typical GHC load.
http://haskell.org/hoogle/?hoogle=%3A%3A+ByteString+-%3E+[Word8]
Also, what's with the non-standard module specification "GHC.Word.Word8"? You should use Data.Word.
Cheers, Thomas
On Wed, Sep 29, 2010 at 9:03 AM, Roderick Ford
wrote: ByteString -> [GHC.Word.Word8]

In addition to hoogle I suggest you check out hackage too. I think
you'll be particularly interested in "base64-bytestring":
http://hackage.haskell.org/package/base64-bytestring
Cheers,
Thomas
On Wed, Sep 29, 2010 at 9:41 AM, Roderick Ford
The idea was to go from Prelude> :t Data.ByteString.readFile Data.ByteString.readFile :: FilePath -> IO Data.ByteString.Internal.ByteString
to here Prelude> :t Codec.Binary.Base64.encode Codec.Binary.Base64.encode :: [GHC.Word.Word8] -> String
unless there is another/easier way????
Roderick
Date: Wed, 29 Sep 2010 09:23:37 -0700 Subject: Re: [Haskell-cafe] can't find in hayoo From: thomas.dubuisson@gmail.com To: developer@live.com CC: haskell-cafe@haskell.org
By and large hayoo is the alta-vista of Haskell search - it has a huge database but isn't well organized or good at prioritizing. Use Hoogle when doing type-based searches for functions in the typical GHC load.
http://haskell.org/hoogle/?hoogle=%3A%3A+ByteString+-%3E+[Word8]
Also, what's with the non-standard module specification "GHC.Word.Word8"? You should use Data.Word.
Cheers, Thomas
On Wed, Sep 29, 2010 at 9:03 AM, Roderick Ford
wrote: ByteString -> [GHC.Word.Word8]
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (3)
-
Antoine Latter
-
Roderick Ford
-
Thomas DuBuisson