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

Safe Haskell | None
Language | Haskell2010

Darcs.Patch.CommuteFn

Synopsis

- type CommuteFn (p1 :: Type -> Type -> Type) (p2 :: Type -> Type -> Type) = forall wX wY. (p1 :> p2) wX wY -> Maybe ((p2 :> p1) wX wY)
- commuterIdFL :: forall (p1 :: Type -> Type -> Type) (p2 :: Type -> Type -> Type). CommuteFn p1 p2 -> CommuteFn p1 (FL p2)
- commuterFLId :: forall (p1 :: Type -> Type -> Type) (p2 :: Type -> Type -> Type). CommuteFn p1 p2 -> CommuteFn (FL p1) p2
- commuterIdRL :: forall (p1 :: Type -> Type -> Type) (p2 :: Type -> Type -> Type). CommuteFn p1 p2 -> CommuteFn p1 (RL p2)
- commuterRLId :: forall (p1 :: Type -> Type -> Type) (p2 :: Type -> Type -> Type). CommuteFn p1 p2 -> CommuteFn (RL p1) p2
- commuterRLFL :: forall (p1 :: Type -> Type -> Type) (p2 :: Type -> Type -> Type). CommuteFn p1 p2 -> CommuteFn (RL p1) (FL p2)
- type MergeFn (p1 :: Type -> Type -> Type) (p2 :: Type -> Type -> Type) = forall wX wY. (p1 :\/: p2) wX wY -> (p2 :/\: p1) wX wY
- type PartialMergeFn (p1 :: Type -> Type -> Type) (p2 :: Type -> Type -> Type) = forall wX wY. (p1 :\/: p2) wX wY -> Maybe ((p2 :/\: p1) wX wY)
- mergerIdFL :: forall (p1 :: Type -> Type -> Type) (p2 :: Type -> Type -> Type). MergeFn p1 p2 -> MergeFn p1 (FL p2)
- type TotalCommuteFn (p1 :: Type -> Type -> Type) (p2 :: Type -> Type -> Type) = forall wX wY. (p1 :> p2) wX wY -> (p2 :> p1) wX wY
- totalCommuterIdFL :: forall (p1 :: Type -> Type -> Type) (p2 :: Type -> Type -> Type). TotalCommuteFn p1 p2 -> TotalCommuteFn p1 (FL p2)
- totalCommuterFLId :: forall (p1 :: Type -> Type -> Type) (p2 :: Type -> Type -> Type). TotalCommuteFn p1 p2 -> TotalCommuteFn (FL p1) p2
- totalCommuterFLFL :: forall (p1 :: Type -> Type -> Type) (p2 :: Type -> Type -> Type). TotalCommuteFn p1 p2 -> TotalCommuteFn (FL p1) (FL p2)
- invertCommuter :: forall (p :: Type -> Type -> Type) (q :: Type -> Type -> Type). (Invert p, Invert q) => CommuteFn p q -> CommuteFn q p

# Documentation

type CommuteFn (p1 :: Type -> Type -> Type) (p2 :: Type -> Type -> Type) = forall wX wY. (p1 :> p2) wX wY -> Maybe ((p2 :> p1) wX wY) #

CommuteFn is the basis of a general framework for building up commutation operations between different patch types in a generic manner. Unfortunately type classes are not well suited to the problem because of the multiple possible routes by which the commuter for (FL p1, FL p2) can be built out of the commuter for (p1, p2) - and more complicated problems when we start building multiple constructors on top of each other. The type class resolution machinery really can't cope with selecting some route, because it doesn't know that all possible routes should be equivalent.

Note that a CommuteFn cannot be lazy i.e. commute patches only when the resulting sequences are demanded. This is because of the possibility of failure (`Nothing`): all the commutes must be performed before we can know whether the overall commute succeeds.

commuterIdFL :: forall (p1 :: Type -> Type -> Type) (p2 :: Type -> Type -> Type). CommuteFn p1 p2 -> CommuteFn p1 (FL p2) #

commuterFLId :: forall (p1 :: Type -> Type -> Type) (p2 :: Type -> Type -> Type). CommuteFn p1 p2 -> CommuteFn (FL p1) p2 #

commuterIdRL :: forall (p1 :: Type -> Type -> Type) (p2 :: Type -> Type -> Type). CommuteFn p1 p2 -> CommuteFn p1 (RL p2) #

commuterRLId :: forall (p1 :: Type -> Type -> Type) (p2 :: Type -> Type -> Type). CommuteFn p1 p2 -> CommuteFn (RL p1) p2 #

commuterRLFL :: forall (p1 :: Type -> Type -> Type) (p2 :: Type -> Type -> Type). CommuteFn p1 p2 -> CommuteFn (RL p1) (FL p2) #

type MergeFn (p1 :: Type -> Type -> Type) (p2 :: Type -> Type -> Type) = forall wX wY. (p1 :\/: p2) wX wY -> (p2 :/\: p1) wX wY #

type PartialMergeFn (p1 :: Type -> Type -> Type) (p2 :: Type -> Type -> Type) = forall wX wY. (p1 :\/: p2) wX wY -> Maybe ((p2 :/\: p1) wX wY) #

mergerIdFL :: forall (p1 :: Type -> Type -> Type) (p2 :: Type -> Type -> Type). MergeFn p1 p2 -> MergeFn p1 (FL p2) #

TODO document laziness or lack thereof

type TotalCommuteFn (p1 :: Type -> Type -> Type) (p2 :: Type -> Type -> Type) = forall wX wY. (p1 :> p2) wX wY -> (p2 :> p1) wX wY #

totalCommuterIdFL :: forall (p1 :: Type -> Type -> Type) (p2 :: Type -> Type -> Type). TotalCommuteFn p1 p2 -> TotalCommuteFn p1 (FL p2) #

TODO document laziness or lack thereof

totalCommuterFLId :: forall (p1 :: Type -> Type -> Type) (p2 :: Type -> Type -> Type). TotalCommuteFn p1 p2 -> TotalCommuteFn (FL p1) p2 #

TODO document laziness or lack thereof

totalCommuterFLFL :: forall (p1 :: Type -> Type -> Type) (p2 :: Type -> Type -> Type). TotalCommuteFn p1 p2 -> TotalCommuteFn (FL p1) (FL p2) #

TODO document laziness or lack thereof

invertCommuter :: forall (p :: Type -> Type -> Type) (q :: Type -> Type -> Type). (Invert p, Invert q) => CommuteFn p q -> CommuteFn q p #

Make use of the inverse-commute law to reduce the number of cases when defining commute for complicated patch types.