[darcs-devel] type of unravel in V1

Ganesh Sittampalam ganesh at earth.li
Sun Feb 16 21:53:24 UTC 2020


Hi,

While working on "fullUnwind", I realised that the way the 'unwindings'
parameter to Merger/Regrem in V1 is constructed and used was quite
opaque and had some unstated invariants. After a series of small
refactorings, I've managed to clean it up quite a bit, along with the
'merger' function that constructs Merger:

https://hub.darcs.net/ganesh/darcs-v1cleanup-draft-20200216

In particular I managed to clarify that for

   p = Merger undo unwindings p1 p2

unwindings always had the form

   ... :<: p1 :<: p

i.e. it ended with the patch itself, except with dummy values for undo
and unwindings that were never actually used.

So I've changed it to just contain the '...' (which could be empty), and
then I add back p1/p on the fly where needed. This also means I can
really use p rather than a dummy variant, as it is no longer stored
within p itself.

I also clarified the witnesses, which I am fairly sure were wrong, and
removed a bunch of unsafeCoerces in the process.

However, I did have to introduce a new one, in 'unravel'. There's a bit
of discussion in the code comments about whether the witnesses on
'publicUnravel' or 'unravel' are correct, with the current conclusion
being that 'publicUnravel' is right, saying that for RepoPatchV1 prim wX
wY, the unravellings should start with wY (whereas unravel says wX).

However after my refactoring I can't get either type to work without
coercions (previously the wX in unravel didn't require any coercions).
This is probably because I have no idea what newUr is actually doing nor
do I really understand what an V1 unwinding actually is :-)

Any hints on that would be welcome.

The patches will need some cleanup before submission, particularly as
they introduce a couple of intermediate types and then remove them
again. Now I know what the end state is I can probably get there more
directly.

I will probably submit the first few, that correct the type of the 'p1'
parameter, sooner, as those are actually needed for 'fullUnwind'.

Cheers,

Ganesh


More information about the darcs-devel mailing list