
Am 12.10.2011 16:02, schrieb Bas van Dijk:
All your ByteString are belong to us...
Hello,
I'm pleased to announce the beta release of vector-bytestring. This library provides the type ByteString which is defined as a type synonym for a storable Vector of Word8s (from the vector package):
type ByteString = Data.Vector.Storable.Vector Word8
It exports the same API as the bytestring package except that the module names are prefixed with: Data.Vector.Storable.ByteString instead of Data.ByteString.
The very ambitious goal of this package is that it will eventually replace our beloved bytestring package. By basing this package on vector, we can benefit from all the optimizations (like stream-fusion!) in that library. We will also have just a single library to test, debug and optimize.
TEST-SUITE
I ported the bytestring test-suite to vector-bytestring. You can run it using:
$ cabal configure --enable-tests; cabal build; cabal test
All 54800 tests pass! Only one property doesn't hold:
prop_show :: ByteString -> Bool prop_show x = show x == show (unpack x)
This is because I don't provide a custom Show instance for ByteStrings but use the one from Vector which shows a vector like "fromList [1,2,3]" instead as "\SOH\STX\ETX" like bytestring does. Hopefully this is not a problem in practice.
All derived Show instances for data types using your ByteString will be different, too. Would it not be simple to use a newtype for ByteString (rather than a synonym)? Cheers Christian