<div class="gmail_quote">On Sat, Mar 7, 2009 at 10:23 PM, Alexander Dunlap <span dir="ltr">&lt;<a href="mailto:alexander.dunlap@gmail.com">alexander.dunlap@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi all,<br>
<br>
For a while now, we have had Data.ByteString[.Lazy][.Char8] for our<br>
fast strings. Now we also have Data.Text, which does the same for<br>
Unicode. These seem to be the standard for dealing with lists of bytes<br>
and characters.<br>
<br>
Now we also have the storablevector, uvector, and vector packages.<br>
These seem to be also useful for unpacked data, *including* Char and<br>
Word8 values.<br>
<br>
What is the difference between bytestring and these new &quot;fast array&quot;<br>
libraries? Are the latter just generalizations of the former?</blockquote><div><br>There are quite a few overlaps and differences among them.<br><br>bytestring is mature and useful for low-level byte buffer manipulations, and also for efficient I/O. This is in part because it uses pinned pointers that can interoperate easily with foreign code. It used to have an early fusion rewriting framework, but that was abandoned. So it will not fuse multiple ByteString traversals into single loops. This library is widely used, and also somewhat abused for text I/O.<br>
<br>storablevector is not mature (I&#39;m not even sure if it&#39;s actually used) and is a derivative of an old version of the bytestring library, and so has similar characteristics for interacting with foreign code. It contains some old fusion code that is sketchy in nature and somewhat likely to be broken. I&#39;m not sure I would recommend using this library.<br>
<br>uvector is, if my memory serves me correctly, a fork of the vector library. It uses modern stream fusion, but is under active development and is a little scary. I&#39;m a little unclear on the exact difference between uvector and vector. Both use arrays that are not pinned, so they can&#39;t be readily used with foreign code. If you want to use either library, understand that you&#39;re embarking on a bracing adventure.<br>
<br>text is not mature, and is based on the same modern fusion framework as uvector and vector. It uses unpinned arrays, but provides functions for dealing with foreign code. It uses a denser encoding than uvector for text, and provides text-oriented functions like splitting on word and line boundaries. Although it&#39;s intended for use with Unicode text, it does not yet provide proper Unicode-aware functions for things like case conversion. It interacts with bytestring to perform conversion to and from standard representations like UTF-8, and (via the text-icu package) ICU for others (SJIS, KOI-8, etc). If you want to use this library, understand that you&#39;re embarking on a bracing adventure.<br>
</div></div>