[darcs-users] [patch385] Resolve issue1942: Fix an IO interleaving bug in old-f...
kowey at darcs.net
Mon Sep 6 10:04:39 UTC 2010
On Sat, Sep 04, 2010 at 15:20:11 +0200, Petr Rockai wrote:
> > 2. Shuffling the patchInfoAndPatch out of hopefullyNoParseError
> > Aside from a refactor, what does this accomplish?
> Because the "i" does not get shuffled out of the scope of the pattern
> match on the result of the parsing by GHC (and I am not sure it could
> be). So to get at "info p" (which comes from the inventory) you have to
> download the patch to see if it parses correctly (to choose the branch
> in hopefullyNoParseError). This was certainly not intentional.
I'm applying this patch
I think you're saying that old way, we have to pattern-match the
readPatch p output in order to build a PatchInfoAnd. This pattern match
would force the file to be fetched even though we're using lazy IO ,
because for readPatch to get a point where it can return a Just, it'd
have to have seen the file contents. This would be wasteful if in
practice, we don't really care about the "And..." part of PatchInfoAnd
and we really just want the PatchInfo itself. The new way builds the
PatchInfoAnd around hopefullyNoParseError so that you can consume the
patchinfo and optionally never touch the readParse output and if we use
lazy IO avoid downloading the patch.
If this is right, then hooray, I'm very slowly starting to understand
how to think about this...
Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow>
For a faster response, try +44 (0)1273 64 2905 or
xmpp:kowey at jabber.fr (Jabber or Google Talk only)
More information about the darcs-users