Christian Maeder <christian.mae...@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/ _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe