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

Bas van Dijk v.dijk.bas at gmail.com
Mon Oct 17 12:14:17 CEST 2011


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.

> - 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?

> 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.

Bas



More information about the Haskell-Cafe mailing list