[darcs-devel] Idea: a new type of patch

Ian Lynagh igloo at earth.li
Sat Apr 30 16:26:45 PDT 2005


On Sat, Apr 30, 2005 at 07:32:01AM -0400, David Roundy wrote:
> 
> Perhaps we could extend the current hunk type to be a bit more like a
> FileContents?  Instead of

I'm not a fan of the FileContents type. It has an odd sort of asymmetry,
and you don't know which is cheaper to compute (well, you probably sort
of do, because it's probably PackedString iff it's not Nothing, but it's
not nice). I'd prefer (Either [PackedString] PackedString) instead;
carrying both around only makes sense if they are equally easy to have
at any given time, which I don't think is ever true in this case.

In actual fact, I think (names not carefully chosen!)

data FileContents = Lines [PackedString] | PSs [PackedString] | PS PackedString

would be even better, where PSs is just a list of packed strings broken
wherever you desire (would be the result of applying a hunk to a
PackedString or of doing token replace).

Or maybe

data FileContents a = Lines [a] | All a

for Stringlike a.


Thanks
Ian





More information about the darcs-devel mailing list