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

Safe HaskellNone
LanguageHaskell2010

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 infixr 1 Source #

Directed Forward Pairs

Constructors

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

Instances

(Eq2 a, Eq2 b) => Eq2 ((:>) a b) Source # 

Methods

unsafeCompare :: (a :> b) wA wB -> (a :> b) wC wD -> Bool Source #

(=\/=) :: (a :> b) wA wB -> (a :> b) wA wC -> EqCheck wB wC Source #

(=/\=) :: (a :> b) wA wC -> (a :> b) wB wC -> EqCheck wA wB Source #

(Show2 a, Show2 b) => Show2 ((:>) a b) Source # 

Methods

showDict2 :: ShowDict ((a :> b) wX wY) Source #

Invert p => Invert ((:>) p p) Source # 

Methods

invert :: (p :> p) wX wY -> (p :> p) wY wX Source #

(Show2 a, Show2 b) => Show1 ((:>) a b wX) Source # 

Methods

showDict1 :: ShowDict ((a :> b) wX wX) Source #

(Eq2 a, Eq2 b) => Eq ((:>) a b wX wY) Source # 

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) Source # 

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 Source #

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) Source # 

Methods

showDict2 :: ShowDict (FL a wX wY) Source #

Invert p => Invert (FL p) Source # 

Methods

invert :: FL p wX wY -> FL p wY wX Source #

PatchInspect p => PatchInspect (FL p) Source # 

Methods

listTouchedFiles :: FL p wX wY -> [FilePath] Source #

hunkMatches :: (ByteString -> Bool) -> FL p wX wY -> Bool Source #

PatchDebug p => PatchDebug (FL p) Source # 

Methods

patchDebugDummy :: FL p wX wY -> () Source #

Commute p => Commute (FL p) Source # 

Methods

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

Merge p => Merge (FL p) Source # 

Methods

merge :: (FL p :\/: FL p) wX wY -> (FL p :/\: FL p) wX wY Source #

(ReadPatch p, PatchListFormat p) => ReadPatch (FL p) Source # 

Methods

readPatch' :: ParserM m => m (Sealed (FL p wX)) Source #

Apply p => Apply (FL p) Source # 

Associated Types

type ApplyState (FL p :: * -> * -> *) :: (* -> *) -> * Source #

Methods

apply :: ApplyMonad (ApplyState (FL p)) m => FL p wX wY -> m () Source #

RepairToFL p => Repair (FL p) Source # 

Methods

applyAndTryToFix :: ApplyMonad (ApplyState (FL p)) m => FL p wX wY -> m (Maybe (String, FL p wX wY)) Source #

Check p => Check (FL p) Source # 

Methods

isInconsistent :: FL p wX wY -> Maybe Doc Source #

FromPrim p => FromPrims (FL p) Source # 

Methods

fromPrims :: FL (PrimOf (FL p)) wX wY -> FL p wX wY Source #

FromPrim p => FromPrim (FL p) Source # 

Methods

fromPrim :: PrimOf (FL p) wX wY -> FL p wX wY Source #

PrimPatchBase p => PrimPatchBase (FL p) Source # 

Associated Types

type PrimOf (FL p :: * -> * -> *) :: * -> * -> * Source #

Effect p => Effect (FL p) Source # 

Methods

effect :: FL p wX wY -> FL (PrimOf (FL p)) wX wY Source #

effectRL :: FL p wX wY -> RL (PrimOf (FL p)) wX wY Source #

CommuteNoConflicts p => CommuteNoConflicts (FL p) Source # 

Methods

commuteNoConflicts :: (FL p :> FL p) wX wY -> Maybe ((FL p :> FL p) wX wY) Source #

(CommuteNoConflicts p, Conflict p) => Conflict (FL p) Source # 

Methods

resolveConflicts :: FL p wX wY -> [[Sealed (FL (PrimOf (FL p)) wY)]] Source #

conflictedEffect :: FL p wX wY -> [IsConflictedPrim (PrimOf (FL p))] Source #

Annotate p => Annotate (FL p) Source # 

Methods

annotate :: FL p wX wY -> AnnotatedM () Source #

Show2 a => Show1 (FL a wX) Source # 

Methods

showDict1 :: ShowDict (FL a wX wX) Source #

Show2 a => Show (FL a wX wZ) Source # 

Methods

showsPrec :: Int -> FL a wX wZ -> ShowS #

show :: FL a wX wZ -> String #

showList :: [FL a wX wZ] -> ShowS #

type ApplyState (FL p) Source # 
type ApplyState (FL p) = ApplyState p
type PrimOf (FL p) Source # 
type PrimOf (FL p) = PrimOf p

data RL a wX wZ where Source #

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) Source # 

Methods

showDict2 :: ShowDict (RL a wX wY) Source #

Invert p => Invert (RL p) Source # 

Methods

invert :: RL p wX wY -> RL p wY wX Source #

PatchInspect p => PatchInspect (RL p) Source # 

Methods

listTouchedFiles :: RL p wX wY -> [FilePath] Source #

hunkMatches :: (ByteString -> Bool) -> RL p wX wY -> Bool Source #

PatchDebug p => PatchDebug (RL p) Source # 

Methods

patchDebugDummy :: RL p wX wY -> () Source #

Commute p => Commute (RL p) Source # 

Methods

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

Merge p => Merge (RL p) Source # 

Methods

merge :: (RL p :\/: RL p) wX wY -> (RL p :/\: RL p) wX wY Source #

(ReadPatch p, PatchListFormat p) => ReadPatch (RL p) Source # 

Methods

readPatch' :: ParserM m => m (Sealed (RL p wX)) Source #

Apply p => Apply (RL p) Source # 

Associated Types

type ApplyState (RL p :: * -> * -> *) :: (* -> *) -> * Source #

Methods

apply :: ApplyMonad (ApplyState (RL p)) m => RL p wX wY -> m () Source #

Check p => Check (RL p) Source # 

Methods

isInconsistent :: RL p wX wY -> Maybe Doc Source #

FromPrim p => FromPrims (RL p) Source # 

Methods

fromPrims :: FL (PrimOf (RL p)) wX wY -> RL p wX wY Source #

PrimPatchBase p => PrimPatchBase (RL p) Source # 

Associated Types

type PrimOf (RL p :: * -> * -> *) :: * -> * -> * Source #

Effect p => Effect (RL p) Source # 

Methods

effect :: RL p wX wY -> FL (PrimOf (RL p)) wX wY Source #

effectRL :: RL p wX wY -> RL (PrimOf (RL p)) wX wY Source #

CommuteNoConflicts p => CommuteNoConflicts (RL p) Source # 

Methods

commuteNoConflicts :: (RL p :> RL p) wX wY -> Maybe ((RL p :> RL p) wX wY) Source #

(CommuteNoConflicts p, Conflict p) => Conflict (RL p) Source # 

Methods

resolveConflicts :: RL p wX wY -> [[Sealed (FL (PrimOf (RL p)) wY)]] Source #

conflictedEffect :: RL p wX wY -> [IsConflictedPrim (PrimOf (RL p))] Source #

Show2 a => Show1 (RL a wX) Source # 

Methods

showDict1 :: ShowDict (RL a wX wX) Source #

Show2 a => Show (RL a wX wZ) Source # 

Methods

showsPrec :: Int -> RL a wX wZ -> ShowS #

show :: RL a wX wZ -> String #

showList :: [RL a wX wZ] -> ShowS #

type ApplyState (RL p) Source # 
type ApplyState (RL p) = ApplyState p
type PrimOf (RL p) Source # 
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 Source #

Forking Pairs (Implicit starting context)

Constructors

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

Instances

(Show2 a, Show2 b) => Show2 ((:\/:) a b) Source # 

Methods

showDict2 :: ShowDict ((a :\/: b) wX wY) Source #

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

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 Source #

Joining Pairs

Constructors

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

Instances

(Show2 a, Show2 b) => Show2 ((:/\:) a b) Source # 

Methods

showDict2 :: ShowDict ((a :/\: b) wX wY) Source #

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

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 Source #

Parallel Pairs

Constructors

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

data Fork common left right wA wX wY Source #

Forking Pair (Explicit starting context)

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

Constructors

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

Functions for FLs and RLs

nullFL :: FL a wX wZ -> Bool Source #

nullRL :: RL a wX wZ -> Bool Source #

lengthFL :: FL a wX wZ -> Int Source #

lengthRL :: RL a wX wZ -> Int Source #

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

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

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

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

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

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

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

allRL :: (forall wA wB. a wA wB -> Bool) -> RL a wX wY -> Bool Source #

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

anyRL :: (forall wA wB. a wA wB -> Bool) -> RL a wX wY -> Bool Source #

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

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

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

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

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

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 Source #

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

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

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

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

(+>>+) :: RL p wX wY -> FL p wY wZ -> FL p wX wZ infixr 5 Source #

Prepend an RL to an FL. This traverses only the left hand side.

(+<<+) :: RL p wX wY -> FL p wY wZ -> RL p wX wZ infixl 5 Source #

Append an FL to an RL. This traverses only the right hand side.

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

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

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

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

FL only

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

foldFL_M :: Monad m => (forall wA wB. r wA -> p wA wB -> m (r wB)) -> r wX -> FL p wX wY -> m (r wY) Source #

Monadic fold over an FL associating to the left, i.e. from left to right. The order of arguments follows the standard foldM from base.

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

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) Source #

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

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

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

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

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

Check that two FLs are equal element by element. This differs from the Eq2 instance for FL which uses commutation.

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

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

initsFL :: FL p wX wY -> [Sealed ((p :> FL p) wX)] Source #

RL only

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

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