[darcs-devel] Replacing Invert instances with an Invertible wrapper

Ganesh Sittampalam ganesh at earth.li
Mon Sep 2 21:32:58 UTC 2019


On 31/08/2019 09:10, Ben Franksen wrote:

> The above construction is somewhat shady. Perhaps this is a design bug.
> What I means is that perhaps class Apply is a mistake and we should
> rather be using Effect and PrimApply directly whenever we apply a patch.
> Another indication this might be the case is that we usually need a
> constraint ApplyState p ~ ApplyState (PrimOf p).

I agree with this. I had a bit of a play and I think it can be done,
though it'll be a bit fiddly and require a bunch of code reorganisation.

The biggest problem is how to write code that is polymorphic over both
primitive and non-primitive patches. I think we'd end up saying that
prim patches have to implement Effect and also define PrimOf (with
PrimOf prim ~ prim).

Cheers,

Ganesh


More information about the darcs-devel mailing list