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

Safe Haskell | None
Language | Haskell2010

Darcs.Patch.V3.Contexted

Contents

- Contexted patches
- Query
- Construct / Modify
- `PatchInspect` helpers
- `ReadPatch` and `ShowPatch` helpers
- Properties

Description

`Contexted` patches.

Synopsis

- data Contexted (p :: Type -> Type -> Type) wX
- ctxId :: forall (p :: Type -> Type -> Type) wX. Ident p => Contexted p wX -> PatchId p
- ctxView :: forall (p :: Type -> Type -> Type) wX. Contexted p wX -> Sealed ((FL p :> p) wX)
- ctxNoConflict :: forall (p :: Type -> Type -> Type) wX. (CleanMerge p, Commute p, Ident p) => Contexted p wX -> Contexted p wX -> Bool
- ctxToFL :: forall (p :: Type -> Type -> Type) wX. Contexted p wX -> Sealed (FL p wX)
- ctxDepends :: forall (p :: Type -> Type -> Type) wX. Ident p => Contexted p wX -> Contexted p wX -> Bool
- ctx :: p wX wY -> Contexted p wX
- ctxAdd :: (Commute p, Invert p, Ident p) => p wX wY -> Contexted p wY -> Contexted p wX
- ctxAddRL :: forall (p :: Type -> Type -> Type) wX wY. (Commute p, Invert p, Ident p) => RL p wX wY -> Contexted p wY -> Contexted p wX
- ctxAddInvFL :: forall (p :: Type -> Type -> Type) wX wY. (Commute p, Invert p, Ident p) => FL p wX wY -> Contexted p wX -> Contexted p wY
- ctxAddFL :: forall (p :: Type -> Type -> Type) wX wY. (Commute p, Invert p, Ident p) => FL p wX wY -> Contexted p wY -> Contexted p wX
- commutePast :: Commute p => p wX wY -> Contexted p wY -> Maybe (Contexted p wX)
- commutePastRL :: forall (p :: Type -> Type -> Type) wX wY. Commute p => RL p wX wY -> Contexted p wY -> Maybe (Contexted p wX)
- ctxTouches :: forall (p :: Type -> Type -> Type) wX. PatchInspect p => Contexted p wX -> [AnchoredPath]
- ctxHunkMatches :: forall (p :: Type -> Type -> Type) wX. PatchInspect p => (ByteString -> Bool) -> Contexted p wX -> Bool
- showCtx :: forall (p :: Type -> Type -> Type) wX. (ShowPatchBasic p, PatchListFormat p) => ShowPatchFor -> Contexted p wX -> Doc
- readCtx :: forall (p :: Type -> Type -> Type) wX. (ReadPatch p, PatchListFormat p) => Parser (Contexted p wX)
- prop_ctxInvariants :: forall (p :: Type -> Type -> Type) wX. (Commute p, Invert p, SignedIdent p) => Contexted p wX -> Bool
- prop_ctxEq :: forall (p :: Type -> Type -> Type) wX. (Commute p, Eq2 p, Ident p) => Contexted p wX -> Contexted p wX -> Bool
- prop_ctxPositive :: forall (p :: Type -> Type -> Type) wX. SignedIdent p => Contexted p wX -> Bool

# Contexted patches

data Contexted (p :: Type -> Type -> Type) wX #

#### Instances

Instances details

Show2 p => Show1 (Contexted p) # |
Instance details Defined in Darcs.Patch.V3.Contexted Methods showDict1 :: Dict (Show (Contexted p wX)) #
Show2 p => Show (Contexted p wX) # |
Instance details Defined in Darcs.Patch.V3.Contexted Methods showsPrec :: Int -> Contexted p wX -> ShowS # show :: Contexted p wX -> String # showList :: [Contexted p wX] -> ShowS #
Ident p => Eq (Contexted p wX) # | Equality between `Contexted` patches reduces to equality of the identifiers of the patches referred to if we look at them from the same context. (This assumes witnesses aren't coerced in an unsafe manner.)
Instance details Defined in Darcs.Patch.V3.Contexted Methods (==) :: Contexted p wX -> Contexted p wX -> Bool # (/=) :: Contexted p wX -> Contexted p wX -> Bool #
Ident p => Ord (Contexted p wX) # |
Instance details Defined in Darcs.Patch.V3.Contexted Methods compare :: Contexted p wX -> Contexted p wX -> Ordering # (<) :: Contexted p wX -> Contexted p wX -> Bool # (<=) :: Contexted p wX -> Contexted p wX -> Bool # (>) :: Contexted p wX -> Contexted p wX -> Bool # (>=) :: Contexted p wX -> Contexted p wX -> Bool # max :: Contexted p wX -> Contexted p wX -> Contexted p wX # min :: Contexted p wX -> Contexted p wX -> Contexted p wX #

# Query

ctxId :: forall (p :: Type -> Type -> Type) wX. Ident p => Contexted p wX -> PatchId p #

Identity of a contexted patch.

ctxView :: forall (p :: Type -> Type -> Type) wX. Contexted p wX -> Sealed ((FL p :> p) wX) #

We sometimes want to pattern match on a `Contexted` patch but still guard against violation of the invariants. So we export a view that is isomorphic to the `Contexted` type but doesn't allow to manipulate the internals.

ctxNoConflict :: forall (p :: Type -> Type -> Type) wX. (CleanMerge p, Commute p, Ident p) => Contexted p wX -> Contexted p wX -> Bool #

`Contexted` patches conflict with each other if the identity of one is in the context of the other or they cannot be merged cleanly.

ctxToFL :: forall (p :: Type -> Type -> Type) wX. Contexted p wX -> Sealed (FL p wX) #

Convert a `Contexted` patch into a plain `FL` with the patch at the end.

ctxDepends :: forall (p :: Type -> Type -> Type) wX. Ident p => Contexted p wX -> Contexted p wX -> Bool #

Wether the first argument is contained (identity-wise) in the context of the second, in other words, the second depends on the first. This does not include equality, only proper dependency.

# Construct / Modify

ctx :: p wX wY -> Contexted p wX #

A `Contexted` patch with empty context.

ctxAdd :: (Commute p, Invert p, Ident p) => p wX wY -> Contexted p wY -> Contexted p wX #

Add a patch to the context of a `Contexted` patch. This is the place where we take care of the invariants.

ctxAddRL :: forall (p :: Type -> Type -> Type) wX wY. (Commute p, Invert p, Ident p) => RL p wX wY -> Contexted p wY -> Contexted p wX #

Add an `RL` of patches to the context.

ctxAddInvFL :: forall (p :: Type -> Type -> Type) wX wY. (Commute p, Invert p, Ident p) => FL p wX wY -> Contexted p wX -> Contexted p wY #

Add an `FL` of patches to the context but invert it first.

ctxAddFL :: forall (p :: Type -> Type -> Type) wX wY. (Commute p, Invert p, Ident p) => FL p wX wY -> Contexted p wY -> Contexted p wX #

Add an `FL` of patches to the context.

commutePast :: Commute p => p wX wY -> Contexted p wY -> Maybe (Contexted p wX) #

(Definition 10.2) Commute a patch past a `Contexted` patch. This commutes it past the context and then past the patch itself. If it succeeds, the patch that we commuted past gets dropped. Note that this does not succeed if the inverted patch is in the `Contexted` patch.

commutePastRL :: forall (p :: Type -> Type -> Type) wX wY. Commute p => RL p wX wY -> Contexted p wY -> Maybe (Contexted p wX) #

Not defined in the paper but used in the commute algorithm.

# `PatchInspect` helpers

ctxTouches :: forall (p :: Type -> Type -> Type) wX. PatchInspect p => Contexted p wX -> [AnchoredPath] #

ctxHunkMatches :: forall (p :: Type -> Type -> Type) wX. PatchInspect p => (ByteString -> Bool) -> Contexted p wX -> Bool #

# `ReadPatch` and `ShowPatch` helpers

showCtx :: forall (p :: Type -> Type -> Type) wX. (ShowPatchBasic p, PatchListFormat p) => ShowPatchFor -> Contexted p wX -> Doc #

readCtx :: forall (p :: Type -> Type -> Type) wX. (ReadPatch p, PatchListFormat p) => Parser (Contexted p wX) #

# Properties

prop_ctxInvariants :: forall (p :: Type -> Type -> Type) wX. (Commute p, Invert p, SignedIdent p) => Contexted p wX -> Bool #

This property states that no prefix of the context commutes with the rest of the `Contexted` patch and that the context never contains a patch and its inverse.

prop_ctxEq :: forall (p :: Type -> Type -> Type) wX. (Commute p, Eq2 p, Ident p) => Contexted p wX -> Contexted p wX -> Bool #

This property states that equal `Contexted` patches have equal content up to reorderings of the context patches.

prop_ctxPositive :: forall (p :: Type -> Type -> Type) wX. SignedIdent p => Contexted p wX -> Bool #

This property states that patches in the context of a `Contexted` patch as well as the patch itself are positive. It does not necessarily hold for all `Contexted` patches.