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

Safe Haskell | None
Language | Haskell2010

Darcs.Patch.Witnesses.Ordered

Contents

- Directed Types
- Merge Types
- Functions

Synopsis

- data (a1 :> a2) wX wY = (a1 wX wZ) :> (a2 wZ wY)
- data FL a wX wZ where
  - (:>:) :: a wX wY -> FL a wY wZ -> FL a wX wZ
  - NilFL :: FL a wX wX
- data RL a wX wZ where
  - (:<:) :: RL a wX wY -> a wY wZ -> RL a wX wZ
  - NilRL :: RL a wX wX
- data (a1 :\/: a2) wX wY = (a1 wZ wX) :\/: (a2 wZ wY)
- data (a3 :/\: a4) wX wY = (a3 wX wZ) :/\: (a4 wY wZ)
- data (a1 :||: a2) wX wY = (a1 wX wY) :||: (a2 wX wY)
- data Fork common left right wA wX wY = Fork (common wA wU) (left wU wX) (right wU wY)
- lengthFL :: FL a wX wZ -> Int
- mapFL :: (forall wW wZ. a wW wZ -> b) -> FL a wX wY -> [b]
- mapFL_FL :: (forall wW wY. a wW wY -> b wW wY) -> FL a wX wZ -> FL b wX wZ
- spanFL :: (forall wW wY. a wW wY -> Bool) -> FL a wX wZ -> (FL a :> FL a) wX wZ
- foldlFL :: (forall wW wY. a -> b wW wY -> a) -> a -> FL b wX wZ -> a
- allFL :: (forall wX wY. a wX wY -> Bool) -> FL a wW wZ -> Bool
- anyFL :: (forall wX wY. a wX wY -> Bool) -> FL a wW wZ -> Bool
- filterFL :: (forall wX wY. a wX wY -> Bool) -> FL a wW wZ -> [Sealed2 a]
- splitAtFL :: Int -> FL a wX wZ -> (FL a :> FL a) wX wZ
- splitAtRL :: Int -> RL a wX wZ -> (RL a :> RL a) wX wZ
- bunchFL :: Int -> FL a wX wY -> FL (FL a) wX wY
- foldlRL :: (forall wW wY. a -> b wW wY -> a) -> a -> RL b wX wZ -> a
- lengthRL :: RL a wX wZ -> Int
- isShorterThanRL :: RL a wX wY -> Int -> Bool
- mapRL :: (forall wW wZ. a wW wZ -> b) -> RL a wX wY -> [b]
- mapRL_RL :: (forall wW wY. a wW wY -> b wW wY) -> RL a wX wZ -> RL b wX wZ
- zipWithFL :: (forall wX wY. a -> p wX wY -> q wX wY) -> [a] -> FL p wW wZ -> FL q wW wZ
- filterOutFLFL :: (forall wX wY. p wX wY -> EqCheck wX wY) -> FL p wW wZ -> FL p wW wZ
- filterOutRLRL :: (forall wX wY. p wX wY -> EqCheck wX wY) -> RL p wW wZ -> RL p wW wZ
- filterRL :: (forall wX wY. p wX wY -> Bool) -> RL p wA wB -> [Sealed2 p]
- reverseFL :: FL a wX wZ -> RL a wX wZ
- reverseRL :: RL a wX wZ -> FL a wX wZ
- (+>+) :: FL a wX wY -> FL a wY wZ -> FL a wX wZ
- (+<+) :: RL a wX wY -> RL a wY wZ -> RL a wX wZ
- nullFL :: FL a wX wZ -> Bool
- concatFL :: FL (FL a) wX wZ -> FL a wX wZ
- concatRL :: RL (RL a) wX wZ -> RL a wX wZ
- snocRLSealed :: FlippedSeal (RL a) wY -> a wY wZ -> FlippedSeal (RL a) wZ
- nullRL :: RL a wX wZ -> Bool
- toFL :: [FreeLeft a] -> Sealed (FL a wX)
- dropWhileFL :: (forall wX wY. a wX wY -> Bool) -> FL a wR wV -> FlippedSeal (FL a) wV
- dropWhileRL :: (forall wX wY. a wX wY -> Bool) -> RL a wR wV -> Sealed (RL a wR)
- spanFL_M :: forall a m wX wZ. Monad m => (forall wW wY. a wW wY -> m Bool) -> FL a wX wZ -> m ((FL a :> FL a) wX wZ)
- mapFL_FL_M :: Monad m => (forall wW wY. a wW wY -> m (b wW wY)) -> FL a wX wZ -> m (FL b wX wZ)
- eqFL :: MyEq a => FL a wX wY -> FL a wX wZ -> EqCheck wY wZ
- eqFLRev :: MyEq a => FL a wX wZ -> FL a wY wZ -> EqCheck wX wY
- eqFLUnsafe :: MyEq a => FL a wX wY -> FL a wZ wW -> Bool

# Directed Types

Darcs patches have a notion of transforming between contexts. This naturally leads us to container types that are "directed" and transform from one context to another.

For example, the swap of names of files x and y could be represented with the following sequence of patches:

     Move x z :> Move y x :> Move z y

or using forward lists, like

     Move x z :>: Move y x :>: Move z y :>: NilFL

data (a1 :> a2) wX wY infixr 1 #

Directed Forward Pairs

Constructors

(a1 wX wZ) :> (a2 wZ wY) infixr 1 |

Instances

(Show2 a, Show2 b) => Show2 ((:>) a b) # |
Methods showDict2 :: ShowDict ((a :> b) wX wY) #
(MyEq a, MyEq b) => MyEq ((:>) a b) # |
Methods unsafeCompare :: (a :> b) wA wB -> (a :> b) wC wD -> Bool # (=\/=) :: (a :> b) wA wB -> (a :> b) wA wC -> EqCheck wB wC # (=/\=) :: (a :> b) wA wC -> (a :> b) wB wC -> EqCheck wA wB #
(Show2 a, Show2 b) => Show1 ((:>) a b wX) # |
Methods showDict1 :: ShowDict ((a :> b) wX wX) #
(MyEq a, MyEq b) => Eq ((:>) a b wX wY) # |
Methods (==) :: (a :> b) wX wY -> (a :> b) wX wY -> Bool # (/=) :: (a :> b) wX wY -> (a :> b) wX wY -> Bool #
(Show2 a, Show2 b) => Show ((:>) a b wX wY) # |
Methods showsPrec :: Int -> (a :> b) wX wY -> ShowS # show :: (a :> b) wX wY -> String # showList :: [(a :> b) wX wY] -> ShowS #

data FL a wX wZ where #

Forward lists

Constructors

(:>:) :: a wX wY -> FL a wY wZ -> FL a wX wZ infixr 5 |
NilFL :: FL a wX wX |

Instances

Show2 a => Show2 (FL a) # |
Methods showDict2 :: ShowDict (FL a wX wY) #
Commute p => Commute (FL p) # |
Methods commute :: (FL p :> FL p) wX wY -> Maybe ((FL p :> FL p) wX wY) #
PatchDebug p => PatchDebug (FL p) # |
Methods patchDebugDummy :: FL p wX wY -> () #
PatchInspect p => PatchInspect (FL p) # |
Methods listTouchedFiles :: FL p wX wY -> [FilePath] # hunkMatches :: (ByteString -> Bool) -> FL p wX wY -> Bool #
Invert p => Invert (FL p) # |
Methods invert :: FL p wX wY -> FL p wY wX #
Merge p => Merge (FL p) # |
Methods merge :: (FL p :\/: FL p) wX wY -> (FL p :/\: FL p) wX wY #
(ReadPatch p, PatchListFormat p) => ReadPatch (FL p) # |
Methods readPatch' :: ParserM m => m (Sealed (FL p wX)) #
Apply p => Apply (FL p) # |
Associated Types type ApplyState (FL p :: * -> * -> *) :: (* -> *) -> * # Methods apply :: ApplyMonad (ApplyState (FL p)) m => FL p wX wY -> m () #
RepairToFL p => Repair (FL p) # |
Methods applyAndTryToFix :: ApplyMonad (ApplyState (FL p)) m => FL p wX wY -> m (Maybe (String, FL p wX wY)) #
Check p => Check (FL p) # |
Methods isInconsistent :: FL p wX wY -> Maybe Doc #
FromPrim p => FromPrims (FL p) # |
Methods fromPrims :: FL (PrimOf (FL p)) wX wY -> FL p wX wY #
FromPrim p => FromPrim (FL p) # |
Methods fromPrim :: PrimOf (FL p) wX wY -> FL p wX wY #
PrimPatchBase p => PrimPatchBase (FL p) # |
Associated Types type PrimOf (FL p :: * -> * -> *) :: * -> * -> * #
Effect p => Effect (FL p) # |
Methods effect :: FL p wX wY -> FL (PrimOf (FL p)) wX wY # effectRL :: FL p wX wY -> RL (PrimOf (FL p)) wX wY #
CommuteNoConflicts p => CommuteNoConflicts (FL p) # |
Methods commuteNoConflicts :: (FL p :> FL p) wX wY -> Maybe ((FL p :> FL p) wX wY) #
(CommuteNoConflicts p, Conflict p) => Conflict (FL p) # |
Methods resolveConflicts :: FL p wX wY -> [[Sealed (FL (PrimOf (FL p)) wY)]] # conflictedEffect :: FL p wX wY -> [IsConflictedPrim (PrimOf (FL p))] #
Show2 a => Show1 (FL a wX) # |
Methods showDict1 :: ShowDict (FL a wX wX) #
Show2 a => Show (FL a wX wZ) # |
Methods showsPrec :: Int -> FL a wX wZ -> ShowS # show :: FL a wX wZ -> String # showList :: [FL a wX wZ] -> ShowS #
type ApplyState (FL p) # |
type ApplyState (FL p) = ApplyState p
type PrimOf (FL p) # |
type PrimOf (FL p) = PrimOf p

data RL a wX wZ where #

Reverse lists

Constructors

(:<:) :: RL a wX wY -> a wY wZ -> RL a wX wZ infixl 5 |
NilRL :: RL a wX wX |

Instances

Show2 a => Show2 (RL a) # |
Methods showDict2 :: ShowDict (RL a wX wY) #
Commute p => Commute (RL p) # |
Methods commute :: (RL p :> RL p) wX wY -> Maybe ((RL p :> RL p) wX wY) #
PatchDebug p => PatchDebug (RL p) # |
Methods patchDebugDummy :: RL p wX wY -> () #
PatchInspect p => PatchInspect (RL p) # |
Methods listTouchedFiles :: RL p wX wY -> [FilePath] # hunkMatches :: (ByteString -> Bool) -> RL p wX wY -> Bool #
Invert p => Invert (RL p) # |
Methods invert :: RL p wX wY -> RL p wY wX #
Merge p => Merge (RL p) # |
Methods merge :: (RL p :\/: RL p) wX wY -> (RL p :/\: RL p) wX wY #
(ReadPatch p, PatchListFormat p) => ReadPatch (RL p) # |
Methods readPatch' :: ParserM m => m (Sealed (RL p wX)) #
Apply p => Apply (RL p) # |
Associated Types type ApplyState (RL p :: * -> * -> *) :: (* -> *) -> * # Methods apply :: ApplyMonad (ApplyState (RL p)) m => RL p wX wY -> m () #
Check p => Check (RL p) # |
Methods isInconsistent :: RL p wX wY -> Maybe Doc #
FromPrim p => FromPrims (RL p) # |
Methods fromPrims :: FL (PrimOf (RL p)) wX wY -> RL p wX wY #
PrimPatchBase p => PrimPatchBase (RL p) # |
Associated Types type PrimOf (RL p :: * -> * -> *) :: * -> * -> * #
Effect p => Effect (RL p) # |
Methods effect :: RL p wX wY -> FL (PrimOf (RL p)) wX wY # effectRL :: RL p wX wY -> RL (PrimOf (RL p)) wX wY #
CommuteNoConflicts p => CommuteNoConflicts (RL p) # |
Methods commuteNoConflicts :: (RL p :> RL p) wX wY -> Maybe ((RL p :> RL p) wX wY) #
(CommuteNoConflicts p, Conflict p) => Conflict (RL p) # |
Methods resolveConflicts :: RL p wX wY -> [[Sealed (FL (PrimOf (RL p)) wY)]] # conflictedEffect :: RL p wX wY -> [IsConflictedPrim (PrimOf (RL p))] #
Show2 a => Show1 (RL a wX) # |
Methods showDict1 :: ShowDict (RL a wX wX) #
Show2 a => Show (RL a wX wZ) # |
Methods showsPrec :: Int -> RL a wX wZ -> ShowS # show :: RL a wX wZ -> String # showList :: [RL a wX wZ] -> ShowS #
type ApplyState (RL p) # |
type ApplyState (RL p) = ApplyState p
type PrimOf (RL p) # |
type PrimOf (RL p) = PrimOf p

# Merge Types

When we have two patches which commute and share the same pre-context we can merge the patches. Whenever patches, or sequences of patches, share a pre-context we say they are Forking Pairs (`:\/:`). The same way, when patches or sequences of patches, share a post-context we say they are Joining Pairs (`:/\:`).

The following diagram shows the symmetry of merge types:

              wZ
             :/\:
         a3 /    \ a4
           /      \
          wX      wY
           \      /
         a1 \    / a2
             :\/:
              wZ

data (a1 :\/: a2) wX wY infix 1 #

Forking Pairs (Implicit starting context)

Constructors

(a1 wZ wX) :\/: (a2 wZ wY) infix 1 |

Instances

(Show2 a, Show2 b) => Show2 ((:\/:) a b) # |
Methods showDict2 :: ShowDict ((a :\/: b) wX wY) #
(Show2 a, Show2 b) => Show ((:\/:) a b wX wY) # |
Methods showsPrec :: Int -> (a :\/: b) wX wY -> ShowS # show :: (a :\/: b) wX wY -> String # showList :: [(a :\/: b) wX wY] -> ShowS #

data (a3 :/\: a4) wX wY infix 1 #

Joining Pairs

Constructors

(a3 wX wZ) :/\: (a4 wY wZ) infix 1 |

Instances

(Show2 a, Show2 b) => Show2 ((:/\:) a b) # |
Methods showDict2 :: ShowDict ((a :/\: b) wX wY) #
(Show2 a, Show2 b) => Show ((:/\:) a b wX wY) # |
Methods showsPrec :: Int -> (a :/\: b) wX wY -> ShowS # show :: (a :/\: b) wX wY -> String # showList :: [(a :/\: b) wX wY] -> ShowS #

data (a1 :||: a2) wX wY infix 1 #

Parallel Pairs

Constructors

(a1 wX wY) :||: (a2 wX wY) infix 1 |

data Fork common left right wA wX wY #

Forking Pair (Explicit starting context)

          wX     wY
           \     /
            \   /
             \ /
              wU
              |
              |
              |
              wA

Constructors

Fork (common wA wU) (left wU wX) (right wU wY) |

# Functions

lengthFL :: FL a wX wZ -> Int #

mapFL :: (forall wW wZ. a wW wZ -> b) -> FL a wX wY -> [b] #

mapFL_FL :: (forall wW wY. a wW wY -> b wW wY) -> FL a wX wZ -> FL b wX wZ #

spanFL :: (forall wW wY. a wW wY -> Bool) -> FL a wX wZ -> (FL a :> FL a) wX wZ #

foldlFL :: (forall wW wY. a -> b wW wY -> a) -> a -> FL b wX wZ -> a #

allFL :: (forall wX wY. a wX wY -> Bool) -> FL a wW wZ -> Bool #

anyFL :: (forall wX wY. a wX wY -> Bool) -> FL a wW wZ -> Bool #

filterFL :: (forall wX wY. a wX wY -> Bool) -> FL a wW wZ -> [Sealed2 a] #

splitAtFL :: Int -> FL a wX wZ -> (FL a :> FL a) wX wZ #

splitAtRL :: Int -> RL a wX wZ -> (RL a :> RL a) wX wZ #

bunchFL :: Int -> FL a wX wY -> FL (FL a) wX wY #

foldlRL :: (forall wW wY. a -> b wW wY -> a) -> a -> RL b wX wZ -> a #

lengthRL :: RL a wX wZ -> Int #

isShorterThanRL :: RL a wX wY -> Int -> Bool #

mapRL :: (forall wW wZ. a wW wZ -> b) -> RL a wX wY -> [b] #

mapRL_RL :: (forall wW wY. a wW wY -> b wW wY) -> RL a wX wZ -> RL b wX wZ #

zipWithFL :: (forall wX wY. a -> p wX wY -> q wX wY) -> [a] -> FL p wW wZ -> FL q wW wZ #

filterOutFLFL :: (forall wX wY. p wX wY -> EqCheck wX wY) -> FL p wW wZ -> FL p wW wZ #

`filterOutFLFL p xs` deletes any `x` in `xs` for which `p x == IsEq` (indicating that `x` has no effect as far as we are concerned, and can be safely removed from the chain)

filterOutRLRL :: (forall wX wY. p wX wY -> EqCheck wX wY) -> RL p wW wZ -> RL p wW wZ #

filterRL :: (forall wX wY. p wX wY -> Bool) -> RL p wA wB -> [Sealed2 p] #

reverseFL :: FL a wX wZ -> RL a wX wZ #

reverseRL :: RL a wX wZ -> FL a wX wZ #

(+>+) :: FL a wX wY -> FL a wY wZ -> FL a wX wZ infixr 5 #

(+<+) :: RL a wX wY -> RL a wY wZ -> RL a wX wZ infixl 5 #

nullFL :: FL a wX wZ -> Bool #

concatFL :: FL (FL a) wX wZ -> FL a wX wZ #

concatRL :: RL (RL a) wX wZ -> RL a wX wZ #

snocRLSealed :: FlippedSeal (RL a) wY -> a wY wZ -> FlippedSeal (RL a) wZ #

nullRL :: RL a wX wZ -> Bool #

toFL :: [FreeLeft a] -> Sealed (FL a wX) #

dropWhileFL :: (forall wX wY. a wX wY -> Bool) -> FL a wR wV -> FlippedSeal (FL a) wV #

dropWhileRL :: (forall wX wY. a wX wY -> Bool) -> RL a wR wV -> Sealed (RL a wR) #

spanFL_M :: forall a m wX wZ. Monad m => (forall wW wY. a wW wY -> m Bool) -> FL a wX wZ -> m ((FL a :> FL a) wX wZ) #

mapFL_FL_M :: Monad m => (forall wW wY. a wW wY -> m (b wW wY)) -> FL a wX wZ -> m (FL b wX wZ) #

eqFL :: MyEq a => FL a wX wY -> FL a wX wZ -> EqCheck wY wZ #

Check that two `FL`s are equal element by element. This differs from the `MyEq` instance for `FL` which uses commutation.

eqFLRev :: MyEq a => FL a wX wZ -> FL a wY wZ -> EqCheck wX wY #

eqFLUnsafe :: MyEq a => FL a wX wY -> FL a wZ wW -> Bool #