3 Dec 04:05
Re: Data.ByteString vs Data.ByteString.Lazy vs Data.ByteString.Char8
Galchin, Vasili <vigalchin <at> gmail.com>
2008-12-03 03:05:13 GMT
2008-12-03 03:05:13 GMT
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.
vasiliOn Tue, Dec 2, 2008 at 5:59 PM, Duncan Coutts <duncan.coutts <at> worc.ox.ac.uk> wrote:Perhaps you need to ask a more specific question.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?
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
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe <at> haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
RSS Feed