[darcs-devel] darcs patch: rewrite ColourPrinter with a policy data... (and 17 more)

Ian Lynagh igloo at earth.li
Fri Apr 8 04:54:34 PDT 2005


On Fri, Apr 08, 2005 at 07:41:50AM -0400, David Roundy wrote:
> 
> > +  prPS ps = let haveTrailingSpc = (not.nullPS) $ takeWhilePS isSpace (reversePS ps)
> > +            in if haveTrailingSpc
> > +                then prString (unpackPS ps)
> > +                else escapePrinter po p
> 
> I don't like the fact that reversePS has to make a separate copy of the
> string here, just to look for trailing whitespace.  Note that takeWhilePS
> (and similar functions) don't copy any of the actual data--just copy the
> pointer and introduce a new offset and length.  So I'd rather introduce a
> takeWhileFromEndPS which could do this more efficiently.

haveTrailingSpc = not (nullPS ps) && isSpace (lastPS ps)


Thanks
Ian





More information about the darcs-devel mailing list