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

Safe HaskellNone

Darcs.Patch.Witnesses.Ordered

Contents

Synopsis

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

Directed Forward Pairs

Constructors

forall wZ . (a1 wX wZ) :> (a2 wZ wY) 

Instances

(MyEq a, MyEq b) => MyEq (:> a b) 
(Show2 a, Show2 b) => Show2 (:> a b) 
(Show2 a, Show2 b) => Show1 (:> a b wX) 
(MyEq a, MyEq b) => Eq (:> a b wX wY) 
(Show2 a, Show2 b) => Show (:> a b wX wY) 

data FL a wX wZ where

Forward lists

Constructors

:>: :: a wX wY -> FL a wY wZ -> FL a wX wZ 
NilFL :: FL a wX wX 

Instances

(MyEq p, Commute p) => MyEq (FL p) 
Show2 a => Show2 (FL a) 
PatchInspect p => PatchInspect (FL p) 
PatchDebug p => PatchDebug (FL p) 
(ReadPatch p, PatchListFormat p) => ReadPatch (FL p) 
Invert p => Invert (FL p) 
Commute p => Commute (FL p) 
Merge p => Merge (FL p) 
Apply p => Apply (FL p) 
RepairToFL p => Repair (FL p) 
Check p => Check (FL p) 
(Apply p, IsHunk p, PatchListFormat p, ShowPatch p) => ShowPatch (FL p) 
(PatchListFormat p, ShowPatchBasic p) => ShowPatchBasic (FL p) 
(IsHunk p, PatchListFormat p, Patchy p) => Patchy (FL p) 
FromPrim p => FromPrims (FL p) 
FromPrim p => FromPrim (FL p) 
PrimPatchBase p => PrimPatchBase (FL p) 
Effect p => Effect (FL p) 
CommuteNoConflicts p => CommuteNoConflicts (FL p) 
(CommuteNoConflicts p, Conflict p) => Conflict (FL p) 
Show2 a => Show1 (FL a wX) 
Show2 a => Show (FL a wX wZ) 

data RL a wX wZ where

Reverse lists

Constructors

:<: :: RL a wX wY -> a wY wZ -> RL a wX wZ 
NilRL :: RL a wX wX 

Instances

(MyEq p, Commute p) => MyEq (RL p) 
Show2 a => Show2 (RL a) 
PatchInspect p => PatchInspect (RL p) 
PatchDebug p => PatchDebug (RL p) 
(ReadPatch p, PatchListFormat p) => ReadPatch (RL p) 
Invert p => Invert (RL p) 
Commute p => Commute (RL p) 
Merge p => Merge (RL p) 
Apply p => Apply (RL p) 
Check p => Check (RL p) 
(Apply p, IsHunk p, PatchListFormat p, ShowPatch p) => ShowPatch (RL p) 
(PatchListFormat p, ShowPatchBasic p) => ShowPatchBasic (RL p) 
(IsHunk p, PatchListFormat p, Patchy p) => Patchy (RL p) 
FromPrim p => FromPrims (RL p) 
PrimPatchBase p => PrimPatchBase (RL p) 
Effect p => Effect (RL p) 
CommuteNoConflicts p => CommuteNoConflicts (RL p) 
(CommuteNoConflicts p, Conflict p) => Conflict (RL p) 
Show2 a => Show1 (RL a wX) 
Show2 a => Show (RL a wX wZ) 

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

Forking Pairs (Implicit starting context)

Constructors

forall wZ . (a1 wZ wX) :\/: (a2 wZ wY) 

Instances

(Show2 a, Show2 b) => Show2 (:\/: a b) 
(Show2 a, Show2 b) => Show (:\/: a b wX wY) 

data (a3 :/\: a4) wX wY

Joining Pairs

Constructors

forall wZ . (a3 wX wZ) :/\: (a4 wY wZ) 

Instances

(Show2 a, Show2 b) => Show2 (:/\: a b) 
(Show2 a, Show2 b) => Show (:/\: a b wX wY) 

data (a1 :||: a2) wX wY

Parallel Pairs

Constructors

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

data Fork common left right wA wX wY

Forking Pair (Explicit starting context)

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

Constructors

forall wU . 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

(+<+) :: 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

Check that two FLs 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