[darcs-devel] darcs patch: read patch sequences truly lazily on lazy read.

David Roundy droundy at abridgegame.org
Sun Jan 9 13:17:38 PST 2005


On Sun, Jan 09, 2005 at 05:59:51PM +0000, Ian Lynagh wrote:
> On Sat, Jan 08, 2005 at 12:39:56PM -0500, David Roundy wrote:
> > This is an attempt at getting lazy parsing to really work, by which I mean
> > that we should be able to take a corrupt patch that is composed of a
> > sequence of patches (with the first few being good), and parse it, and
> > print the resulting patch (with putDoc . showPatch), and should get some
> > output before the parse error failure gets thrown.
> 
> Can't we already do that? With the attached patch applied, running unit
> gives this:

Thanks for clearing this up.  Obviously I didn't bother testing the code,
but I didn't see how it could possibly work! :) Sorry about that.  I think
it's that I'm so used to think of monads as being inherently strict--the
"do" notation seems like it means "do this first, and then do that", so I
couldn't see how it could work even with your tricky use of let.

So now, I guess we just need to see if there is somewhere we can actually
*use* lazy parsing to make darcs use less memory... which is definitely a
job for either another day, or another person (or perhaps both...)!

I imagine a good test case for lazy parsing could be implementing an option
to optimize which would parse and then reprint the patches in the
repository.  I think AJ suggested this a while back.  The point would be to
fix patches formatted according to older darcs customs.  I imagine that
when dealing with larger patches, this could make a big difference in the
memory usage, and with such a simple application (just reading and writing
patches) it'd be relatively easy to verify (and if necesary, debug) the
memory usage benefits.  If anyone wants to volunteer to do this, feel free!
-- 
David Roundy
http://www.darcs.net




More information about the darcs-devel mailing list