[Haskell-cafe] Small strings

Michael Snoyman michael at snoyman.com
Mon Dec 6 07:08:14 CET 2010


On Mon, Dec 6, 2010 at 8:04 AM, Antoine Latter <aslatter at gmail.com> wrote:
> Hi Haskell,
>
> I've recently created the 'smallstring' package[1] and put it on
> Hackage. The goal was to create a string-like type with as little
> memory overhead as possible, and to have equality and comparison
> operations be competitive with the native String type. The idea is
> that this type would make ideal keys into data structures like
> Data.Map.
>
> I've taken pains to make the library portable to other compilers, but
> this isn't really tested, and most of my recent development has been
> on GHC 7. The library is young and likely has places it could be
> improved, so your feedback is welcome.
>
> The API provided is small - to/fromString along with Eq and Ord instances.
>
> This isn't meant to be a replacement for the text[2] or bytestring[3]
> packages - the reduced size comes at a cost. Both of these libraries
> offer substring manipulation functions which allow the sharing of the
> backing memory buffers. Also, I haven't implemented any sort of
> string-like operations on the type as it isn't the right thing for
> that.
>
> I've borrowed heavily from the previously mentioned text package for
> the underlying array implementation, so thanks goes to Bryan
> O'Sullivan for maintaining the package and to all of the other authors
> as well.

Is there a reason that you don't include an IsString instance?

Michael



More information about the Haskell-Cafe mailing list