substring search api

Justin Bailey jgbailey at
Tue Sep 18 12:12:26 EDT 2007

On 9/18/07, Duncan Coutts <duncan.coutts at> wrote:
> I want to start a discussion about a string searching api, especially with
> respect to ByteStrings.

My use case for searching bytestrings was to determine where a
particular substring occurred in a search string. Thus, I needed the
index. Taking the length of a string returned in a tuple would give me
that index, but would feel dirty. I've seen DonS post enough to NOT
take "length" that I wouldn't have thought to do that.

I also wonder if the "tupling" style would make it easier to produce
space leaks, especially if the "overlapping" behavior caused the tail
of each string to be included. I don't quite understand sharing and
the bytestring implementation to know how much of a concern that would

I have to agree with Chris that I prefer findSubstrings to return a
list of Int/Int64s, rather than the tuples.


More information about the Libraries mailing list