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

Ben Franksen bugs at darcs.net
Tue Aug 27 18:53:48 UTC 2019


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

>> 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.
> 
> The class/instance combination is needed to break the recursive knot.
> The same is true of Nonable. The alternative would be hs-boot files.

I see. But then I wouldn't move the class to RepoPatchV2, just delete
the instances we don't need and remove ToPrim from the superclasses of
RepoPatch. It is cleaner to have a class that could, in principle, be
defined for many patch types inside the general Darcs.Patch section.
(While Nonable is clearly an implementation detail of RepoPatchV2.) Also
means less churn if later we decide we need toPrim for something after all.

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


More information about the darcs-devel mailing list