darcs-2.18.2: a distributed, interactive, smart revision control system

Safe Haskell | None
Language | Haskell2010

Darcs.Patch.Commute

Synopsis

- class Commute (p :: Type -> Type -> Type) where
  - commute :: (p :> p) wX wY -> Maybe ((p :> p) wX wY)
- commuteFL :: forall (p :: Type -> Type -> Type) wX wY. Commute p => (p :> FL p) wX wY -> Maybe ((FL p :> p) wX wY)
- commuteRL :: forall (p :: Type -> Type -> Type) wX wY. Commute p => (RL p :> p) wX wY -> Maybe ((p :> RL p) wX wY)
- commuteRLFL :: forall (p :: Type -> Type -> Type) wX wY. Commute p => (RL p :> FL p) wX wY -> Maybe ((FL p :> RL p) wX wY)
- selfCommuter :: forall (p :: Type -> Type -> Type). Commute p => CommuteFn p p

# Documentation

class Commute (p :: Type -> Type -> Type) where #

Class of patches that that can be commuted.

Instances should obey the following laws:

commute-symmetry

      commute (p:>q) == Just (q':>p') <=> commute (q':>p') == Just (p':>q)

invert-commute

  If patches are invertible, then

      commute (p:>q) == Just (q':>p') <=> commute (invert q:>invert p) == Just (invert p':>invert q')

The more general law

square-commute

      commute (p:>q) == Just (q':>p') => commute (invert p:>q') == Just (q:>invert p')

is valid in general only provided we know (a priori) that ``commute` (`invert` p`:>`q')` succeeds, in other words, that p and q are not in conflict with each other. See Darcs.Patch.CommuteNoConflicts for an extended discussion.

Methods

commute :: (p :> p) wX wY -> Maybe ((p :> p) wX wY) #

#### Instances

Instances details

Commute Prim # |
Instance details Defined in Darcs.Patch.Prim.FileUUID.Commute Methods commute :: (Prim :> Prim) wX wY -> Maybe ((Prim :> Prim) wX wY) #
Commute Prim # |
Instance details Defined in Darcs.Patch.Prim.V1.Commute Methods commute :: (Prim :> Prim) wX wY -> Maybe ((Prim :> Prim) wX wY) #
Commute RebaseName # |
Instance details Defined in Darcs.Patch.Rebase.Name Methods commute :: (RebaseName :> RebaseName) wX wY -> Maybe ((RebaseName :> RebaseName) wX wY) #
Commute Prim # |
Instance details Defined in Darcs.Patch.V1.Prim Methods commute :: (Prim :> Prim) wX wY -> Maybe ((Prim :> Prim) wX wY) #
Commute Prim # |
Instance details Defined in Darcs.Patch.V2.Prim Methods commute :: (Prim :> Prim) wX wY -> Maybe ((Prim :> Prim) wX wY) #
Commute p => Commute (LabelledPatch p) # |
Instance details Defined in Darcs.Patch.Choices Methods commute :: (LabelledPatch p :> LabelledPatch p) wX wY -> Maybe ((LabelledPatch p :> LabelledPatch p) wX wY) #
Commute p => Commute (Invertible p) # |
Instance details Defined in Darcs.Patch.Invertible Methods commute :: (Invertible p :> Invertible p) wX wY -> Maybe ((Invertible p :> Invertible p) wX wY) #
Commute p => Commute (Named p) # |
Instance details Defined in Darcs.Patch.Named Methods commute :: (Named p :> Named p) wX wY -> Maybe ((Named p :> Named p) wX wY) #
(PatchId p ~ PatchInfo, Commute p) => Commute (PatchInfoAndG p) # |
Instance details Defined in Darcs.Patch.PatchInfoAnd Methods commute :: (PatchInfoAndG p :> PatchInfoAndG p) wX wY -> Maybe ((PatchInfoAndG p :> PatchInfoAndG p) wX wY) #
Commute prim => Commute (RebaseChange prim) # |
Instance details Defined in Darcs.Patch.Rebase.Change Methods commute :: (RebaseChange prim :> RebaseChange prim) wX wY -> Maybe ((RebaseChange prim :> RebaseChange prim) wX wY) #
Commute prim => Commute (RebaseFixup prim) # |
Instance details Defined in Darcs.Patch.Rebase.Fixup Methods commute :: (RebaseFixup prim :> RebaseFixup prim) wX wY -> Maybe ((RebaseFixup prim :> RebaseFixup prim) wX wY) #
PrimPatch prim => Commute (RepoPatchV1 prim) # |
Instance details Defined in Darcs.Patch.V1.Commute Methods commute :: (RepoPatchV1 prim :> RepoPatchV1 prim) wX wY -> Maybe ((RepoPatchV1 prim :> RepoPatchV1 prim) wX wY) #
PrimPatch prim => Commute (RepoPatchV2 prim) # |
Instance details Defined in Darcs.Patch.V2.RepoPatch Methods commute :: (RepoPatchV2 prim :> RepoPatchV2 prim) wX wY -> Maybe ((RepoPatchV2 prim :> RepoPatchV2 prim) wX wY) #
Commute p => Commute (FL p) # |
Instance details Defined in Darcs.Patch.Commute Methods commute :: (FL p :> FL p) wX wY -> Maybe ((FL p :> FL p) wX wY) #
Commute p => Commute (RL p) # |
Instance details Defined in Darcs.Patch.Commute Methods commute :: (RL p :> RL p) wX wY -> Maybe ((RL p :> RL p) wX wY) #
(SignedId name, Commute p) => Commute (PrimWithName name p) # |
Instance details Defined in Darcs.Patch.Prim.WithName Methods commute :: (PrimWithName name p :> PrimWithName name p) wX wY -> Maybe ((PrimWithName name p :> PrimWithName name p) wX wY) #
(SignedId name, StorableId name, PrimPatch prim) => Commute (RepoPatchV3 name prim) # |
Instance details Defined in Darcs.Patch.V3.Core Methods commute :: (RepoPatchV3 name prim :> RepoPatchV3 name prim) wX wY -> Maybe ((RepoPatchV3 name prim :> RepoPatchV3 name prim) wX wY) #

commuteFL :: forall (p :: Type -> Type -> Type) wX wY. Commute p => (p :> FL p) wX wY -> Maybe ((FL p :> p) wX wY) #

`commuteFL` commutes a single element past a FL.

commuteRL :: forall (p :: Type -> Type -> Type) wX wY. Commute p => (RL p :> p) wX wY -> Maybe ((p :> RL p) wX wY) #

`commuteRL` commutes a RL past a single element.

commuteRLFL :: forall (p :: Type -> Type -> Type) wX wY. Commute p => (RL p :> FL p) wX wY -> Maybe ((FL p :> RL p) wX wY) #

`commuteRLFL` commutes an `RL` past an `FL`.

selfCommuter :: forall (p :: Type -> Type -> Type). Commute p => CommuteFn p p #

Build a commuter between a patch and itself using the operation from the type class.