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

Ben Franksen bugs at darcs.net
Mon Aug 12 20:47:37 UTC 2019


Ben Franksen <ben.franksen at online.de> added the comment:

>> 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.

I hope so. The problematic piece will probably be patch selection. I
believe we display some patches in inverted form e.g. for rollback. I'll
just have to try and see if I can refactor any remaining uses of invert.

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

No, I think your's is better, overall. Before you push to screened,
please make sure cabal new-haddock works, I dimly remember that
annotating constructors is still missing, even with a haddock that comes
with recent ghc versions, and results in a syntax error :(  ...and while
we're at it we should check which ghc version we require nowadays, with
extensions like DerivingVia and whatnot. I am using ghc-8.6 since quite
a while, but I think we shouldn't require it if that's not necessary.

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


More information about the darcs-devel mailing list