darcs-2.16.2: 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 # 
Instance details

Defined in Darcs.Patch.Witnesses.Ordered

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 # 
Instance details

Defined in Darcs.Patch.Witnesses.Ordered

Methods

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

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

Defined in Darcs.Patch.Invert

Methods

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

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

Defined in Darcs.Patch.Witnesses.Ordered

Methods

showDict1 :: Dict (Show ((a :> b) wX wX0)) Source #

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

Defined in Darcs.Patch.Witnesses.Ordered

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 # 
Instance details

Defined in Darcs.Patch.Witnesses.Ordered

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
(Eq2 p, Commute p) => Eq2 (FL p) Source # 
Instance details

Defined in Darcs.Patch.Permutations

Methods

unsafeCompare :: FL p wA wB -> FL p wC wD -> Bool Source #

(=\/=) :: FL p wA wB -> FL p wA wC -> EqCheck wB wC Source #

(=/\=) :: FL p wA wC -> FL p wB wC -> EqCheck wA wB Source #

Show2 a => Show2 (FL a) Source # 
Instance details

Defined in Darcs.Patch.Witnesses.Ordered

Methods

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

Invert p => Invert (FL p) Source # 
Instance details

Defined in Darcs.Patch.Invert

Methods

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

PatchDebug p => PatchDebug (FL p) Source # 
Instance details

Defined in Darcs.Patch.Debug

Methods

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

Commute p => Commute (FL p) Source # 
Instance details

Defined in Darcs.Patch.Commute

Methods

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

Merge p => Merge (FL p) Source # 
Instance details

Defined in Darcs.Patch.Merge

Methods

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

CleanMerge p => CleanMerge (FL p) Source # 
Instance details

Defined in Darcs.Patch.Merge

Methods

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

PatchInspect p => PatchInspect (FL p) Source # 
Instance details

Defined in Darcs.Patch.Inspect

Methods

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

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

Apply p => Apply (FL p) Source # 
Instance details

Defined in Darcs.Patch.Apply

Associated Types

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

Methods

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

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

(PatchListFormat p, ShowPatch p) => ShowPatch (FL p) Source # 
Instance details

Defined in Darcs.Patch.Viewing

Methods

content :: FL p wX wY -> Doc Source #

description :: FL p wX wY -> Doc Source #

summary :: FL p wX wY -> Doc Source #

summaryFL :: FL (FL p) wX wY -> Doc Source #

thing :: FL p wX wY -> String Source #

things :: FL p wX wY -> String Source #

(Apply p, IsHunk p, PatchListFormat p, ShowContextPatch p) => ShowContextPatch (FL p) Source # 
Instance details

Defined in Darcs.Patch.Viewing

Methods

showContextPatch :: ApplyMonad (ApplyState (FL p)) m => ShowPatchFor -> FL p wX wY -> m Doc Source #

(PatchListFormat p, ShowPatchBasic p) => ShowPatchBasic (FL p) Source # 
Instance details

Defined in Darcs.Patch.Viewing

Methods

showPatch :: ShowPatchFor -> FL p wX wY -> Doc Source #

(Commute p, Ident p) => IdEq2 (FL p) Source #

The Commute requirement here is not technically needed but makes sense logically.

Instance details

Defined in Darcs.Patch.Ident

Methods

(=\^/=) :: FL p wA wB -> FL p wA wC -> EqCheck wB wC Source #

(=/^\=) :: FL p wA wC -> FL p wB wC -> EqCheck wA wB Source #

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

Defined in Darcs.Patch.Read

Methods

readPatch' :: Parser (Sealed (FL p wX)) Source #

RepairToFL p => Repair (FL p) Source # 
Instance details

Defined in Darcs.Patch.Repair

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 # 
Instance details

Defined in Darcs.Patch.Repair

Methods

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

PrimPatchBase p => PrimPatchBase (FL p) Source # 
Instance details

Defined in Darcs.Patch.FromPrim

Associated Types

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

Summary p => Summary (FL p) Source # 
Instance details

Defined in Darcs.Patch.Summary

Methods

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

Effect p => Effect (FL p) Source # 
Instance details

Defined in Darcs.Patch.Effect

Methods

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

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

Defined in Darcs.Patch.Witnesses.Ordered

Methods

showDict1 :: Dict (Show (FL a wX wX0)) Source #

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

Defined in Darcs.Patch.Witnesses.Ordered

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 # 
Instance details

Defined in Darcs.Patch.Apply

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

Defined in Darcs.Patch.FromPrim

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
(Eq2 p, Commute p) => Eq2 (RL p) Source # 
Instance details

Defined in Darcs.Patch.Permutations

Methods

unsafeCompare :: RL p wA wB -> RL p wC wD -> Bool Source #

(=\/=) :: RL p wA wB -> RL p wA wC -> EqCheck wB wC Source #

(=/\=) :: RL p wA wC -> RL p wB wC -> EqCheck wA wB Source #

Show2 a => Show2 (RL a) Source # 
Instance details

Defined in Darcs.Patch.Witnesses.Ordered

Methods

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

Invert p => Invert (RL p) Source # 
Instance details

Defined in Darcs.Patch.Invert

Methods

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

PatchDebug p => PatchDebug (RL p) Source # 
Instance details

Defined in Darcs.Patch.Debug

Methods

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

Commute p => Commute (RL p) Source # 
Instance details

Defined in Darcs.Patch.Commute

Methods

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

PatchInspect p => PatchInspect (RL p) Source # 
Instance details

Defined in Darcs.Patch.Inspect

Methods

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

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

Apply p => Apply (RL p) Source # 
Instance details

Defined in Darcs.Patch.Apply

Associated Types

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

Methods

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

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

(PatchListFormat p, ShowPatch p) => ShowPatch (RL p) Source # 
Instance details

Defined in Darcs.Patch.Viewing

Methods

content :: RL p wX wY -> Doc Source #

description :: RL p wX wY -> Doc Source #

summary :: RL p wX wY -> Doc Source #

summaryFL :: FL (RL p) wX wY -> Doc Source #

thing :: RL p wX wY -> String Source #

things :: RL p wX wY -> String Source #

(ShowContextPatch p, Apply p, IsHunk p, PatchListFormat p) => ShowContextPatch (RL p) Source # 
Instance details

Defined in Darcs.Patch.Viewing

Methods

showContextPatch :: ApplyMonad (ApplyState (RL p)) m => ShowPatchFor -> RL p wX wY -> m Doc Source #

(PatchListFormat p, ShowPatchBasic p) => ShowPatchBasic (RL p) Source # 
Instance details

Defined in Darcs.Patch.Viewing

Methods

showPatch :: ShowPatchFor -> RL p wX wY -> Doc Source #

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

Defined in Darcs.Patch.Read

Methods

readPatch' :: Parser (Sealed (RL p wX)) Source #

Check p => Check (RL p) Source # 
Instance details

Defined in Darcs.Patch.Repair

Methods

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

PrimPatchBase p => PrimPatchBase (RL p) Source # 
Instance details

Defined in Darcs.Patch.FromPrim

Associated Types

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

Effect p => Effect (RL p) Source # 
Instance details

Defined in Darcs.Patch.Effect

Methods

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

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

Defined in Darcs.Patch.Witnesses.Ordered

Methods

showDict1 :: Dict (Show (RL a wX wX0)) Source #

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

Defined in Darcs.Patch.Witnesses.Ordered

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 # 
Instance details

Defined in Darcs.Patch.Apply

type ApplyState (RL p) = ApplyState p
type PrimOf (RL p) Source # 
Instance details

Defined in Darcs.Patch.FromPrim

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 # 
Instance details

Defined in Darcs.Patch.Witnesses.Ordered

Methods

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

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

Defined in Darcs.Patch.Witnesses.Ordered

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 # 
Instance details

Defined in Darcs.Patch.Witnesses.Ordered

Methods

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

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

Defined in Darcs.Patch.Witnesses.Ordered

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 #

foldrFL :: (forall wA wB. p wA wB -> r -> r) -> FL p wX wY -> r -> r Source #

The "natural" fold over an FL i.e. associating to the right. Like foldr only with the more useful order of arguments.

foldlRL :: (forall wA wB. r -> p wA wB -> r) -> r -> RL p wX wY -> r Source #

The "natural" fold over an RL i.e. associating to the left.

foldrwFL :: (forall wA wB. p wA wB -> r wB -> r wA) -> FL p wX wY -> r wY -> r wX Source #

Right associative fold for FLs that transforms a witnessed state in the direction opposite to the FL. This is the "natural" fold for FLs i.e. the one which replaces the :>: with the passed operator.

foldlwRL :: (forall wA wB. r wA -> p wA wB -> r wB) -> r wX -> RL p wX wY -> r wY Source #

The analog of foldrwFL for RLs. This is the "natural" fold for RLs i.e. the one which replaces the :<: with the passed operator.

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 #

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, sequencing effects from left to right. The order of arguments follows the standard foldM from base.

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

Monadic fold over an FL associating to the right, sequencing effects from right to left. Mostly useful for prepend-like operations with an effect where the order of effects is not relevant.

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 #

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.

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 #

spanRL :: (forall wA wB. p wA wB -> Bool) -> RL p wX wY -> (RL p :> RL p) wX wY Source #

Like span only for RLs. This function is supposed to be lazy: elements before the split point should not be touched.

breakRL :: (forall wA wB. p wA wB -> Bool) -> RL p wX wY -> (RL p :> RL p) wX wY Source #

Like break only for RLs. This function is supposed to be lazy: elements before the split point should not be touched.

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

Like takeWhile only for RLs. This function is supposed to be lazy: elements before the split point should not be touched.

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