[Haskell-cafe] Data.ByteString vs Data.ByteString.Lazy vs Data.ByteString.Char8

Galchin, Vasili vigalchin at gmail.com
Tue Dec 2 22:05:13 EST 2008


I think I am getting a namespace collition between

      Data.ByteString.Lazy.Char8.ByteString

and

     Data.ByteString.Lazy.Internal.ByteString ....

here is the error message ....

    Couldn't match expected type `B.ByteString'
           against inferred type
`bytestring-0.9.0.1:Data.ByteString.Lazy.Internal.ByteString'




On Tue, Dec 2, 2008 at 8:18 PM, Galchin, Vasili <vigalchin at gmail.com> wrote:

> I am getting a collision with "Internal" .... sigh.
>
>
> vasili
>
>
> On Tue, Dec 2, 2008 at 5:59 PM, Duncan Coutts <duncan.coutts at worc.ox.ac.uk
> > wrote:
>
>> On Tue, 2008-12-02 at 17:43 -0600, Galchin, Vasili wrote:
>> > Hello,
>> >
>> >      Some mention is made in corresponding web pages about
>> > implementation difference of these three different DataString impl.
>> > Any advice?
>>
>> Perhaps you need to ask a more specific question.
>>
>> Data.ByteString is a simple strict sequence of bytes (as Word8). That
>> means the whole thing is in memory at once in one big block.
>>
>> Data.ByteString.Char8 provides the same type as Data.ByteString but the
>> operations are in terms of 8-bit Chars. This is for use in files and
>> protocols that contain ASCII as a subset. This is particularly useful
>> for protocols containing mixed text and binary content. It should not be
>> used instead of proper Unicode.
>>
>>
>> Data.ByteString.Lazy is a different representation. As the name
>> suggests, it's lazy like a lazy list. So like a list the whole thing
>> does not need to be in memory if it can be processed incrementally. It
>> supports lazy IO, like getContents does for String. It is particularly
>> useful for handling long or unbounded streams of data in a pure style.
>>
>> Data.ByteString.Lazy.Char8 is the Char8 equivalent.
>>
>> Duncan
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20081202/7c5c2a7c/attachment.htm


More information about the Haskell-Cafe mailing list