[darcs-devel] a preview of some work in progress: abstracting over Prim

Ganesh Sittampalam ganesh at earth.li
Thu Nov 18 23:53:29 UTC 2010


[moving thread to darcs-devel]

On Thu, 18 Nov 2010, Petr Rockai wrote:

> Hi,
>
> Ganesh Sittampalam <ganesh at earth.li> writes:
>> The basic point of the work is to untangle the Prim patch type from the rest of
>> the codebase and hide it behind an abstract interface. I also am working on
>> making V1 and V2 patches parameterised over the underlying Prim type.
>>
>> The current repo is at
>> http://darcs.vm.spiny.org.uk/~ganesh/darcs-primabstract-staging
>
> for the record: I have read through the patches and they are basically
> screened as far as I am concerned. Ganesh said he will wait a while
> before actually pushing them to screened to give room for potential
> vetoes (I agree that rolling back a bundle like this would constitute
> major suckage).

To give an overview so people can decide whether they care:

I've reorganised Darcs.Patch.Prim and a bunch of other modules that 
implemented class instances for Prim or used its internals. The series is 
a bunch of incremental changes, mostly moving code around and making a few 
associated changes. The end result is by no means perfect, but naturally I 
think it's an improvement!

In the process I also remove Split patches, which were obsolete a long 
time ago, but make sure that we can still read them (in the same way as I 
did for ComP). I also remove the Identity constructor from Prim, as it 
doesn't seem to be actually needed and I don't like the unnecessary 
redundancy (what's the difference between NilFL and Identity :>: NilFL, 
for example?).

Almost everything that used Prim now uses a type function (PrimOf p) on 
the actual patch type p, which would be either Patch for V1 or RealPatch 
for V2. There's also a class 'PrimPatch' which wraps up all the operations 
that Prim needs to support for the outside world. The existing Prim 
becomes Darcs.Patch.Prim.V1.Prim (one might argue about whether we should 
use Vn for both prim patches and non-prim patches, but that should be a 
cheap darcs replace to fix.)

Following on from this, I then turn Patch and RealPatch into Patch prim 
and RealPatch prim, and of course ensure that in practice Patch Prim and 
RealPatch Prim are what get actually used.

The main point of this is so that we can actually start work on a new Prim 
type for V3 patches as and when we feel like it. The immediate trigger was 
actually just so I can experiment with some ideas I have for attributing 
conflicts to their original named patch, but it stands independently of 
those experiments.

I will push a final version of this work to screened late on Sunday, 
unless there are any objections. If you need more time to decide whether 
you object, that's fine too, just let me know.

Cheers,

Ganesh


More information about the darcs-devel mailing list