[Haskell-cafe] String vs ByteString

Michael Snoyman michael at snoyman.com
Fri Aug 13 07:47:26 EDT 2010


On Fri, Aug 13, 2010 at 2:42 PM, Johan Tibell <johan.tibell at gmail.com>wrote:

> Hi Erik,
>
>
> On Fri, Aug 13, 2010 at 1:32 PM, Erik de Castro Lopo <mle+hs at mega-nerd.com<mle%2Bhs at mega-nerd.com>
> > wrote:
>
>> Since the files are large I'm using ByteString, but that leads me
>> to wonder what is the best way to handle clashes between Prelude
>> functions like putStrLn and the ByteString versions?
>>
>> Anyone have any suggestions for doing this as neatly as possible?
>>
>
> Use qualified imports, like so:
>
> import qualified Data.ByteString as B
>

main = B.putStrLn $ B.pack "test"
>
> If you want to pack a String into a ByteString, you'll need to import
Data.ByteString.Char8 instead.

Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100813/3017744b/attachment.html


More information about the Haskell-Cafe mailing list