[darcs-devel] V3.commuteNoConflicts side conditions

Ganesh Sittampalam ganesh at earth.li
Tue Aug 13 14:28:40 UTC 2019


Hi,

I'm looking at the side-conditions on commuteNoConflicts in V3. As Ben
suggested a little while ago, I'm paying special attention to whether
they should cause commute failure or errors.

One simple example is the Prim :> Conflictor case:

  commuteNoConflicts (Prim p :> Conflictor s y q)
    | Just (s' :> p') <- commuteFL (p :> s)
    , Just q' <- commutePast p' q
    , Just y' <- S.fromList <$> mapM (commutePast p') (S.toList y) =
        Just (Conflictor s' y' q' :> Prim p')

I guess that the normal laws about commuting should apply to
commuteNoConflicts, in particular that two patches should consistently
commute or not, no matter what context they are in?

If so, it suggests to me that once we have established that p and q
commute - i.e. that commutePast has succeded - any other commute
failures should be errors rather than just causing commuteNoConflicts to
return Nothing.

Alternatively, maybe we should be using something like ctxAdd on the
last line (which will always succeed) instead of commutePast (which
might fail).

If any of the earlier commutes fail, it implies p and q can never live
next to each other so it's correct for the commute to fail. But we would
need to make sure that in each case we are doing the minimum work
necessary to get p next to q.

Cheers,

Ganesh


More information about the darcs-devel mailing list