| darcs-2.4.3: a distributed, interactive, smart revision control system | Source code | Contents | Index
Darcs.Patch.Permutations
Synopsis
removeFL :: (MyEq p, Commute p) => p -> FL p -> Maybe (FL p)
removeRL :: (MyEq p, Commute p) => p -> RL p -> Maybe (RL p)
removeCommon :: (MyEq p, Commute p) => (FL p :\/: FL p) -> FL p :\/: FL p
commuteWhatWeCanFL :: Commute p => (p :> FL p) -> FL p :> (p :> FL p)
commuteWhatWeCanRL :: Commute p => (RL p :> p) -> RL p :> (p :> RL p)
genCommuteWhatWeCanRL :: ((p :> p) -> Maybe (p :> p)) -> (RL p :> p) -> RL p :> (p :> RL p)
partitionFL :: Commute p => (p -> Bool) -> FL p -> FL p :> FL p
partitionRL :: Commute p => (p -> Bool) -> RL p -> RL p :> RL p
head_permutationsFL :: Commute p => FL p -> [FL p]
head_permutationsRL :: Commute p => RL p -> [RL p]
headPermutationsFL :: Commute p => FL p -> [p :> FL p]
remove_subsequenceFL :: (MyEq p, Commute p) => FL p -> FL p -> Maybe (FL p)
remove_subsequenceRL :: (MyEq p, Commute p) => RL p -> RL p -> Maybe (RL p)
partitionConflictingFL :: (Commute p1, Invert p1) => CommuteFn p1 p2 -> FL p1 -> p2 -> FL p1 :> FL p1
type CommuteFn p1 p2 = (p1 :> p2) -> Maybe (p2 :> p1)
selfCommuter :: Commute p => CommuteFn p p
commuterIdRL :: CommuteFn p1 p2 -> CommuteFn p1 (RL p2)
Documentation
removeFL :: (MyEq p, Commute p) => p -> FL p -> Maybe (FL p) | Source
`removeFL` `x xs` removes `x` from `xs` if `x` can be commuted to its head. Otherwise it returns `Nothing`
removeRL :: (MyEq p, Commute p) => p -> RL p -> Maybe (RL p) | Source
`removeRL` is like `removeFL` except with `RL`
removeCommon :: (MyEq p, Commute p) => (FL p :\/: FL p) -> FL p :\/: FL p | Source
commuteWhatWeCanFL :: Commute p => (p :> FL p) -> FL p :> (p :> FL p) | Source
commuteWhatWeCanRL :: Commute p => (RL p :> p) -> RL p :> (p :> RL p) | Source
genCommuteWhatWeCanRL :: ((p :> p) -> Maybe (p :> p)) -> (RL p :> p) -> RL p :> (p :> RL p) | Source
partitionFL | Source
:: Commute p |
=> p -> Bool | predicate; if true we would like the patch in the left list
-> FL p | input `FL`
-> FL p :> FL p | left and right results
split an `FL` into left and right lists according to a predicate, using commutation as necessary. If a patch does satisfy the predicate but cannot be commuted past one that does not satisfy the predicate, it goes in the right list.
partitionRL | Source
:: Commute p |
=> p -> Bool | predicate; if true we would like the patch in the right list
-> RL p | input `RL`
-> RL p :> RL p | left and right results
split an `RL` into left and right lists according to a predicate, using commutation as necessary. If a patch does satisfy the predicate but cannot be commuted past one that does not satisfy the predicate, it goes in the left list.
head_permutationsFL :: Commute p => FL p -> [FL p] | Source
This is a minor variant of `headPermutationsFL` with each permutation is simply returned as a `FL`
head_permutationsRL :: Commute p => RL p -> [RL p] | Source
`head_permutationsRL` is like `headPermutationsFL`, except that we operate on an `RL` (in other words, we are pushing things to the end of a patch sequence instead of to the beginning).
headPermutationsFL :: Commute p => FL p -> [p :> FL p] | Source
`headPermutationsFL` `p:>:ps` returns all the permutations of the list in which one element of `ps` is commuted past `p` Suppose we have a sequence of patches
      X h a y s-t-c k
Suppose furthermore that the patch `c` depends on `t`, which in turn depends on `s`. This function will return
     X :> h a y s t c k
     h :> X a y s t c k
     a :> X h y s t c k
     y :> X h a s t c k
     s :> X h a y t c k
     k :> X h a y s t c
remove_subsequenceFL :: (MyEq p, Commute p) => FL p -> FL p -> Maybe (FL p) | Source
`remove_subsequenceFL` `ab abc` returns `Just c'` where all the patches in `ab` have been commuted out of it, if possible. If this is not possible for any reason (the set of patches `ab` is not actually a subset of `abc`, or they can't be commuted out) we return `Nothing`.
remove_subsequenceRL :: (MyEq p, Commute p) => RL p -> RL p -> Maybe (RL p) | Source
`remove_subsequenceRL` is like `remove_subsequenceFL` except that it works on `RL`
partitionConflictingFL :: (Commute p1, Invert p1) => CommuteFn p1 p2 -> FL p1 -> p2 -> FL p1 :> FL p1 | Source
Partition a list into the patches that commute with the given patch and those that don't (including dependencies)
type CommuteFn p1 p2 = (p1 :> p2) -> Maybe (p2 :> p1) | Source
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.
selfCommuter :: Commute p => CommuteFn p p | Source
Build a commuter between a patch and itself using the operation from the type class.
commuterIdRL :: CommuteFn p1 p2 -> CommuteFn p1 (RL p2) | Source
Produced by Haddock version 2.4.2