Data.ByteString vs Data.ByteString.Lazy vs Data.ByteString.Char8

Hello, Some mention is made in corresponding web pages about implementation difference of these three different DataString impl. Any advice? Regards, Vasili

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

I am getting a collision with "Internal" .... sigh.
vasili
On Tue, Dec 2, 2008 at 5:59 PM, Duncan Coutts
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

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
I am getting a collision with "Internal" .... sigh.
vasili
On Tue, Dec 2, 2008 at 5:59 PM, Duncan Coutts
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

"Galchin, Vasili"
I think I am getting a namespace collition between
Data.ByteString.Lazy.Char8.ByteString
and
Data.ByteString.Lazy.Internal.ByteString ....
You rarely need to import 'Internal' directly.
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'
Are you sure this is not just a versioning problem? I.e. that some library is built against bytestring-0.X.Y, but your current import is bytestring-0.A.B, but your program expects these to be the same? (And they probably are, but the compiler can't really tell). -k -- If I haven't seen further, it is by standing in the footprints of giants

On Wed, Dec 3, 2008 at 1:32 AM, Ketil Malde
"Galchin, Vasili"
writes: I think I am getting a namespace collition between
Data.ByteString.Lazy.Char8.ByteString
and
Data.ByteString.Lazy.Internal.ByteString ....
You rarely need to import 'Internal' directly.
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'
Are you sure this is not just a versioning problem? I.e. that some library is built against bytestring-0.X.Y, but your current import is bytestring-0.A.B, but your program expects these to be the same? (And they probably are, but the compiler can't really tell).
^^ oh great ;^) how can ascertain this situation? - vasili
-k -- If I haven't seen further, it is by standing in the footprints of giants

Warning: This package indirectly depends on multiple versions of the same
package. This is highly likely to cause a compile failure.
package binary-0.4.2 requires bytestring-0.9.0.1
package bio-0.3.4.1 requires bytestring-0.9.1.0
ah ha .. Ketil, this is what you are saying? If so, how do I fix? install a
newer version of binary?
regards, vasili
On Wed, Dec 3, 2008 at 1:32 AM, Ketil Malde
"Galchin, Vasili"
writes: I think I am getting a namespace collition between
Data.ByteString.Lazy.Char8.ByteString
and
Data.ByteString.Lazy.Internal.ByteString ....
You rarely need to import 'Internal' directly.
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'
Are you sure this is not just a versioning problem? I.e. that some library is built against bytestring-0.X.Y, but your current import is bytestring-0.A.B, but your program expects these to be the same? (And they probably are, but the compiler can't really tell).
-k -- If I haven't seen further, it is by standing in the footprints of giants

based on "ghc-pkg list" ....
in my "global" ghc install I have bytestring-0.9.0.1
in my "local" ghc install I have bytestring-0.9.1.0
this difference of versions I strongly think is causing my problems..
When I run "cabal install bytestring" from the CLI, I get "resolving
differences" ....
If my assertion that the "delta" between the "global" vs "local" is causing
my compile problems, then what should I do??
Regards, Vasili
On Wed, Dec 3, 2008 at 1:52 AM, Galchin, Vasili
Warning: This package indirectly depends on multiple versions of the same package. This is highly likely to cause a compile failure. package binary-0.4.2 requires bytestring-0.9.0.1 package bio-0.3.4.1 requires bytestring-0.9.1.0
ah ha .. Ketil, this is what you are saying? If so, how do I fix? install a newer version of binary?
regards, vasili
On Wed, Dec 3, 2008 at 1:32 AM, Ketil Malde
wrote: "Galchin, Vasili"
writes: I think I am getting a namespace collition between
Data.ByteString.Lazy.Char8.ByteString
and
Data.ByteString.Lazy.Internal.ByteString ....
You rarely need to import 'Internal' directly.
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'
Are you sure this is not just a versioning problem? I.e. that some library is built against bytestring-0.X.Y, but your current import is bytestring-0.A.B, but your program expects these to be the same? (And they probably are, but the compiler can't really tell).
-k -- If I haven't seen further, it is by standing in the footprints of giants

"Galchin, Vasili"
Warning: This package indirectly depends on multiple versions of the same package. This is highly likely to cause a compile failure. package binary-0.4.2 requires bytestring-0.9.0.1 package bio-0.3.4.1 requires bytestring-0.9.1.0
ah ha .. Ketil, this is what you are saying?
Yes, exactly.
If so, how do I fix? install a newer version of binary?
Just recompiling it against bytestring-0.9.1.0 would suffice. You really should anyway, bytestring-0.9.0.1 has a nasty performance issue. -k -- If I haven't seen further, it is by standing in the footprints of giants

On Wed, 2008-12-03 at 01:52 -0600, Galchin, Vasili wrote:
Warning: This package indirectly depends on multiple versions of the same package. This is highly likely to cause a compile failure. package binary-0.4.2 requires bytestring-0.9.0.1 package bio-0.3.4.1 requires bytestring-0.9.1.0
ah ha .. Ketil, this is what you are saying? If so, how do I fix? install a newer version of binary?
This is the most significant issue that cabal-install addresses. It works out what needs to be rebuilt to get consistent dependencies. In this example you could run: $ cabal install --dry-run in the directory containing your package and it will say what it would install or re-install to be able to build your package. If you drop the --dry-run then it will actually do it, including installing your package. Duncan
participants (3)
-
Duncan Coutts
-
Galchin, Vasili
-
Ketil Malde