[Haskell-cafe] ANNOUNCE: vector-bytestring-0.0.0.0

Christian Maeder Christian.Maeder at dfki.de
Mon Oct 17 13:12:58 CEST 2011


Am 17.10.2011 12:14, schrieb Bas van Dijk:
> On 17 October 2011 10:18, Christian Maeder<Christian.Maeder at dfki.de>  wrote:
>> I think the cleanest solution (just from a theoretical point of view) is to
>> use a newtype for your byte strings.
>>
>> - it should have the same performance
>> - allows to make ByteString really abstract when hiding the newtype
>> constructor
>
> But what would a newtype ByteString = ByteString (Vector Word8)
> abstract over? What's there to hide? Vectors are already abstract so
> users can't mess with their internals.

Maybe some of the functions that start with "unsafe"? Or why do you use
the safe variant (VS.head) in your own implementation?

http://hackage.haskell.org/packages/archive/vector/0.9/doc/html/Data-Vector-Storable.html#t:Vector

>> - is portable and supplies control over all other instances (not just Show)
>
> What other instances (besides Show) should have different semantics
> than those of Vector?

instance Read (and maybe the vector package will evolve further).

>> I'm not sure if one could make really bad thinks to your ByteString by using
>> the Vector interface, but one would want to disallow vector operations just
>> for compatible with other byte strings.
>
> My idea is that when vector-bytestring is as fast as bytestring, it
> can replace it. When that happens it doesn't matter if users use the
> vector interface. I would even recommend it over using the bytestring
> interface so that bytestring can eventually be deprecated in favor of
> vector.

So your package basically supports an unfortunate mix of bytestring and 
vector functions? How about proposing a better bytestring interface (if 
it should not just be that of vector)?

Btw. a really abstract bytestring could easily be implemented on top of 
your package.

Cheers Christian

>
> Bas



More information about the Haskell-Cafe mailing list