[darcs-devel] FastPackedString issues

Donald Bruce Stewart dons at cse.unsw.edu.au
Thu Aug 25 22:57:39 PDT 2005


droundy:
> On Thu, Aug 25, 2005 at 02:47:37PM +1000, Donald Bruce Stewart wrote:
> > While writing some unit tests for FastPackedString, I found two issues.
> > The first problem is initPS. It seems to have an off-by-one error:
> 
> Indeed, this does look like a bug.  I'd say a more thorough solution might
> be to eliminate the (confusing) substrPS function.  It is only used twice
> and one of those uses is buggy! And it's not exported from
> FastPackedString.  I think initPS and tailPS will be much more clearly
> written as

...

Good idea. I've now removed substrPS, and added your initPS/tailPS
implementations.

> > The second is that linesPS/unlinesPS aren't equivalent to lines/unlines.  The
> 
> For non-darcs usage, it might be nice to mimic the behavior of lines and
> unlines, but in my opinion the linesPS behavior is much more useful,
> although somewhat less intuitive.

Ok, maybe we should keep the darcs-style unlinesPS/linesPS, but with
alternate names, so as not to confuse people expecting line/unlines
behaviour. Any suggestions?

Also, I see: 
    Prelude Data.FastPackedString> words "a          b"
    ["a","b"]
    Prelude Data.FastPackedString> wordsPS (packString "a          b")
    ["a","","","","","","","","","","b"]

The difference is:
    wordsPS ps = filter (not.nullPS) (splitWithPS isSpace ps)
versus:
    wordsPS ps = splitWithPS isSpace ps

So you've picked a different wordsPS implementation too?

-- Don




More information about the darcs-devel mailing list