[darcs-devel] [patch1867] improve doc comments for Rotcilfnoc

Ganesh Sittampalam bugs at darcs.net
Mon Aug 12 19:35:08 UTC 2019


Ganesh Sittampalam <ganesh at earth.li> added the comment:

On 12/08/2019 19:46, Ben Franksen wrote:

> I have often wondered if it wouldn't be cleaner if we dropped the Invert
> instances for RepoPatches and Named patches. Of course this requires
> that we turn CleanMerge into a primitive notion (because at the level of
> prim patches, inversion does make sense and is needed to establish the
> relation between commute and clean merge), but this is something I want
> to do that anyway. The global invariant would no longer be needed then
> (all non-prim patches would be positive by definition).

Every so often I play with trying to track positive/negative in the type
system, and then give up when it gets too hard. Yesterday was one such
time :-)

The rough approach I tried was to add an Inverse type family to Invert,
i.e. the inverse of a patch is not necessarily the same type. Then add
constraints all over the place for primitive patches to say that they
actually are self-inverse, and for non-primitive patches try to avoid
that constraint. But it always gets tricky at the boundaries between
those layers.

Simply dropping the Invert instance entirely may well be easier.

Let me know if you're happy with my changed version or would prefer to
keep your original docs.

__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/patch1867>
__________________________________


More information about the darcs-devel mailing list