[darcs-devel] [patch1849] move PrimPatchId into its own module (and 1 more)
Ben Franksen
bugs at darcs.net
Sun Jul 14 10:27:55 UTC 2019
Ben Franksen <ben.franksen at online.de> added the comment:
Here is a alternative patch that implements the ideas I sketched in my
comment, except the last one about abstracting subordinate PatchIds. This
means we use PatchInfo in the interface which I think is okay for now.
I am not sure why it depends on the equality stuff; it should be easy to
rebase it to avoid that dependency.
3 patches for repository http://darcs.net/screened:
patch de792b6ffc34f785e7f02463d6ab503fdd465207
Author: Ben Franksen <ben.franksen at online.de>
Date: Fri Jun 28 20:25:32 CEST 2019
* automatically specialize merging and equality for sequences of patches with identity
The idea is to allow patch sequences to adapt their behavior depending on
whether the patch type has an Ident instance or not. This is done for two
reasons:
(1) equality tests for, and removing elements from sequences of patches is
much faster if we can use PatchIds;
(2) merging sequences of patches with identity must first remove duplicate
patches, otherwise these would be wrongly treated as conflicting.
The new class Sequence abstracts over the basic operations we want to
specialize for FL and RL: equality and removing elements. Similarly, class
Merge gets a new method mergeFLs.
By using the new DerivingVia extension we can derive the Sequence instances
for patch types with an Ident instance from one template definition for a
suitable newtype wrapper named HasIdent.
The fastRemoveXXX functions are now gone from the Patch API and only used
internally inside D.P.Ident, the ugly IdEq2 class could be fully removed.
patch 1362fe7224611f2b5593ce90406551a9b21cf3c6
Author: Ben Franksen <ben.franksen at online.de>
Date: Sun Jun 30 21:26:07 CEST 2019
* clean up patch equality
We make a clear distinction between semantic and structural equality. The
former is captured by Eq2, the latter by the new class StructuralEq2. We use
nominal equality as optimization for semantic equality where available.
Structural equality is understood to be local; it should not refer to
structural equality of its components but rather to their semantic equality.
Thus the new definitions for StructuralEq2 are quite similar to those which
previously defined Eq2. Some of the equality definitions have been cleaned
up and streamlined, for instance the two basic prim patch types now use
deriving Eq instead of manually written definitions.
There remain no /uses/ of unsafeCompare throughout the code except in
RepoPatchV1 and in the default method definitions for Eq2. It still appears
in many places to define Eq2, though, since this is quite convenient.
patch 9f4f344a0e0b1179793142179974b534f7775246
Author: Ben Franksen <ben.franksen at online.de>
Date: Sun Jul 14 11:19:35 CEST 2019
* refactor the interface for creating Named patches from prims
This uncouples the type family PatchId from class Ident, so we can use it
for patch types that have no instance Ident. This allows us to change the
type of method fromPrim to receive a 'PatchId p' instead of the raw
ingredients of a PrimPatchId. We add method fromPrims so we can delegate
generating prim patch ids to the implementation of the RepoPatch type. The
default method definitions for fromPrim and fromPrims ignore their input, so
we don't even have to create dummy type instances for PatchId.
We add the function positivePrimPatchIds to the interface of NamedPrim to
support implementation of fromPrims for RepoPatchV3. This hides the serial
numbers from client code which are now an implementation detail of
NamedPrim. The function takes a PatchInfo as input, so the fact that we use
the hash of the PatchInfo underneath is now also an implementation detail. A
single exception is made with unsafePrimPatchId which we need (only) in the
harness to define an instance Arbitrary.
__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/patch1849>
__________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-preview.txt
Type: text/x-darcs-patch
Size: 67406 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/darcs-devel/attachments/20190714/77aac8cb/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: automatically-specialize-merging-and-equality-for-sequences-of-patches-with-identity.dpatch
Type: application/x-darcs-patch
Size: 121811 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/darcs-devel/attachments/20190714/77aac8cb/attachment-0003.bin>
-------------- next part --------------
.
More information about the darcs-devel
mailing list