[darcs-devel] [patch1701] refactorings in the Darcs.Patch subsystem

Ben Franksen bugs at darcs.net
Tue Sep 11 22:16:17 UTC 2018


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

> Should we just add Commute as a superclass of CommuteNoConflicts?
> Even though it's not necessary for the implementation I don't think it's
> useful not to have it.

I had to think a while about this but now I think you are right. The crux is
that for commuteNoConflicts we require the square-commute law to hold, while
for commute it does not hold in general (only the weaker inverse-commute law
holds up; this is the price we pay for getting a total merge operation). So
saying 'instance CommuteNoConflicts T' is a stronger statement than
'instance Commute T', which means Commute should be a superclass of
CommuteNoConflicts. I was confused by the fact that we use
commuteNoConflicts in the implementation of commute, but this is a common
situation (see e.g. Applicative => Monad). In addition, CommuteNoConflicts
should be a superclass of PrimPatch, so we can use mergeNoConflicts for
them.

4 patches for repository http://darcs.net/screened:

patch 0df21caac925062b51b94d5096038430917a85b8
Author: Ben Franksen <ben.franksen at online.de>
Date:   Sat Sep  8 13:13:36 CEST 2018
  * factor CommuteNoConflicts to its own module
  
  Also improved the documentation for it and for mergeNoConflicts.

patch f24efab271e665cc68f67ff6ccd372f27aad94d4
Author: Ben Franksen <ben.franksen at online.de>
Date:   Sat Sep  8 18:50:01 CEST 2018
  * make CommuteNoConflicts a superclass of PrimPatch
  
  This allows to use mergeNoConflicts for prim patches. An alternative would
  be to scrap CommuteNoConflicts and instead add commuteNoCnflicts to the
  Commute class.

patch 47e841900c023bd58d881aa237670bfba98f8b11
Author: Ben Franksen <ben.franksen at online.de>
Date:   Sat Sep  8 16:32:25 CEST 2018
  * use generic commuter functions to scrap boilerplate

patch ead2bc98b2835e7102a708cdad5f553b4f3d54e1
Author: Ben Franksen <ben.franksen at online.de>
Date:   Wed Sep 12 00:00:05 CEST 2018
  * make Commute a superclass of CommuteNoConflicts

__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/patch1701>
__________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-preview.txt
Type: text/x-darcs-patch
Size: 19689 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/darcs-devel/attachments/20180911/c3ea6fab/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: factor-commutenoconflicts-to-its-own-module.dpatch
Type: application/x-darcs-patch
Size: 22333 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/darcs-devel/attachments/20180911/c3ea6fab/attachment-0003.bin>
-------------- next part --------------
.






More information about the darcs-devel mailing list