[darcs-devel] [patch1880] decouple RepoPatchV3 impl from NamedPrim

Ganesh Sittampalam bugs at darcs.net
Fri Aug 16 13:20:30 UTC 2019


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

I've made a start on the 'NamedPatch' idea, and I think it
would go through fairly easily. Regardless of whether
we use it in RepoPatchV3, it's a nice refactoring of
NamedPrim into the things that are specific to PrimPatchId
and the things that aren't, so I would be inclined to keep
it in some form.

I'm less sure about using it explicitly in RepoPatchV3. It
makes the types even longer whereas they actually get
simpler with the PrimContents approach, albeit with more
constraints.

It's really a choice about designing interfaces (in this case
between RepoPatchV3 and the underlying prim): we can have
one with a rigid structure, or a more flexible one expressed
via constraints. The rigid structure is, well, rigid, with
the flexible one the constraints can become overwhelming.

Some notes on the details of the type:

I found calling it NamedPatch too confusing given
Darcs.Patch.Named. We can't refactor that easily because
it also has explicit dependencies in the type. I ended
up calling it Darcs.Patch.Ident.WithIdent since it's
closely associated with Ident. Better ideas welcome.

As you mention, the Commute instance for PrimPatchId
needs to make sure a patch conflicts with itself.
The current implementation with abs obviously needs
abstracting somehow, we could manually write something
like absId i = if positiveId i then i else invertId i.
I also wonder if we should always just fail the commute,
or if some of the cases should be considered internal
errors.

My current WIP uses the RepoPatchV3Core name and also
some pattern synonyms, just to make it easy to make
the changes incrementally. In a final version I'd
rename RepoPatchV3Core and probably also drop the synonyms.

1 patch for repository darcs-unstable at darcs.net:screened:

patch b50a077c08ea8886ac10ab0e4c6fd89e802375ef
Author: Ganesh Sittampalam <ganesh at earth.li>
Date:   Fri Aug 16 13:27:35 BST 2019
  * WIP: introduce WithIdent and make NamedPrim a type synonym

__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/patch1880>
__________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-preview.txt
Type: text/x-darcs-patch
Size: 5714 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/darcs-devel/attachments/20190816/60474f78/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wip_-introduce-withident-and-make-namedprim-a-type-synonym.dpatch
Type: application/x-darcs-patch
Size: 45867 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/darcs-devel/attachments/20190816/60474f78/attachment-0003.bin>
-------------- next part --------------
.





More information about the darcs-devel mailing list