[darcs-devel] [patch1896] move class ToFromPrim to RepoPatchV2 code

Ben Franksen bugs at darcs.net
Tue Aug 27 16:14:06 UTC 2019


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

> In principle it seems like a 'toPrim' method might be
> a worthwhile part of the API of patches in general, and
> I have a feeling I introduced ToFromPrim initially when
> abstracting the Prim API in the first place.
> 
> But in practice it doesn't seem to be used outside V2,
> and it's not obvious that other patch types should
> implement it for no actual reason.
> 
> 1 patch for repository darcs-unstable at darcs.net:screened:
> 
> patch f5dab200ee7599dfcb8c41c41d8e129ebf2ff559
> Author: Ganesh Sittampalam <ganesh at earth.li>
> Date:   Sun Aug 18 19:31:20 BST 2019
>   * move class ToFromPrim to RepoPatchV2 code
>   
>   It's only used there and isn't currently a concept that's
>   generally useful in the Darcs code as a whole.

If it weren't for V2-Duplicates we could use toPrim to detect whether a
patch is conflicted or not. This could then be used to refactor
combineConflicts to have a simpler and more intuitive type. But this is
hypothetical and so I came to a similar conclusion some time ago.

However, a class with only one instance makes no sense. A plain function

  toPrim :: RepoPatchV2 prim wX wY -> prim wX wY

is what I'd go for.

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


More information about the darcs-devel mailing list