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

Ertugrul Soeylemez es at ertes.de
Mon Oct 17 11:10:17 CEST 2011


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
> - is portable and supplies control over all other instances (not just
> Show)
>
> 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.
>
> It would require more work just on your side, though.

Also such an implementation wouldn't be big news.  You would get stream
fusion as news, but I'm specifically excited about the idea that I can
use the vector interface.

I see no need to restrict the ByteString interface, since it is a pretty
low level data structure anyway.  You use it to process raw ByteStrings
and as such should get maximum flexibility in doing so.  Every
restriction means that in a certain edge case you can't get high
performance, because the author decided that you aren't smart enough to
use the underlying interface, something which I always found annoying
about some of the Haskell libraries.

So please, please, please, if you decide to use a newtype, do /not/ hide
the constructor.


Greets,
Ertugrul


-- 
nightmare = unsafePerformIO (getWrongWife >>= sex)
http://ertes.de/





More information about the Haskell-Cafe mailing list