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

Safe HaskellNone
LanguageHaskell2010

Darcs.Patch.Prim.Class

Synopsis

Documentation

class PrimConstruct prim where Source #

Methods

addfile :: FilePath -> prim wX wY Source #

rmfile :: FilePath -> prim wX wY Source #

adddir :: FilePath -> prim wX wY Source #

rmdir :: FilePath -> prim wX wY Source #

move :: FilePath -> FilePath -> prim wX wY Source #

changepref :: String -> String -> String -> prim wX wY Source #

hunk :: FilePath -> Int -> [ByteString] -> [ByteString] -> prim wX wY Source #

tokreplace :: FilePath -> String -> String -> String -> prim wX wY Source #

binary :: FilePath -> ByteString -> ByteString -> prim wX wY Source #

primFromHunk :: FileHunk wX wY -> prim wX wY Source #

anIdentity :: prim wX wX Source #

Instances
PrimConstruct Prim Source # 
Instance details

Defined in Darcs.Patch.Prim.V1.Core

PrimConstruct Prim Source # 
Instance details

Defined in Darcs.Patch.Prim.FileUUID.Core

PrimConstruct Prim Source # 
Instance details

Defined in Darcs.Patch.V2.Prim

PrimConstruct Prim Source # 
Instance details

Defined in Darcs.Patch.V1.Prim

class PrimCanonize prim where Source #

Methods

tryToShrink :: FL prim wX wY -> FL prim wX wY Source #

tryToShrink ps simplifies ps by getting rid of self-cancellations or coalescing patches

Question (Eric Kow): what properties should this have? For example, the prim1 implementation only gets rid of the first self-cancellation it finds (as far as I can tell). Is that OK? Can we try harder?

tryShrinkingInverse :: FL prim wX wY -> Maybe (FL prim wX wY) Source #

tryShrinkingInverse ps deletes the first subsequence of primitive patches that is followed by the inverse subsequence, if one exists. If not, it returns Nothing

sortCoalesceFL :: FL prim wX wY -> FL prim wX wY Source #

sortCoalesceFL ps coalesces as many patches in ps as possible, sorting the results in some standard order.

canonize :: DiffAlgorithm -> prim wX wY -> FL prim wX wY Source #

It can sometimes be handy to have a canonical representation of a given patch. We achieve this by defining a canonical form for each patch type, and a function canonize which takes a patch and puts it into canonical form. This routine is used by the diff function to create an optimal patch (based on an LCS algorithm) from a simple hunk describing the old and new version of a file.

canonizeFL :: DiffAlgorithm -> FL prim wX wY -> FL prim wX wY Source #

canonizeFL ps puts a sequence of primitive patches into canonical form. Even if the patches are just hunk patches, this is not necessarily the same set of results as you would get if you applied the sequence to a specific tree and recalculated a diff.

Note that this process does not preserve the commutation behaviour of the patches and is therefore not appropriate for use when working with already recorded patches (unless doing amend-record or the like).

coalesce :: (prim :> prim) wX wY -> Maybe (FL prim wX wY) Source #

Instances
PrimCanonize Prim Source # 
Instance details

Defined in Darcs.Patch.Prim.V1.Coalesce

Methods

tryToShrink :: FL Prim wX wY -> FL Prim wX wY Source #

tryShrinkingInverse :: FL Prim wX wY -> Maybe (FL Prim wX wY) Source #

sortCoalesceFL :: FL Prim wX wY -> FL Prim wX wY Source #

canonize :: DiffAlgorithm -> Prim wX wY -> FL Prim wX wY Source #

canonizeFL :: DiffAlgorithm -> FL Prim wX wY -> FL Prim wX wY Source #

coalesce :: (Prim :> Prim) wX wY -> Maybe (FL Prim wX wY) Source #

PrimCanonize Prim Source # 
Instance details

Defined in Darcs.Patch.Prim.FileUUID.Coalesce

Methods

tryToShrink :: FL Prim wX wY -> FL Prim wX wY Source #

tryShrinkingInverse :: FL Prim wX wY -> Maybe (FL Prim wX wY) Source #

sortCoalesceFL :: FL Prim wX wY -> FL Prim wX wY Source #

canonize :: DiffAlgorithm -> Prim wX wY -> FL Prim wX wY Source #

canonizeFL :: DiffAlgorithm -> FL Prim wX wY -> FL Prim wX wY Source #

coalesce :: (Prim :> Prim) wX wY -> Maybe (FL Prim wX wY) Source #

PrimCanonize Prim Source # 
Instance details

Defined in Darcs.Patch.V2.Prim

Methods

tryToShrink :: FL Prim wX wY -> FL Prim wX wY Source #

tryShrinkingInverse :: FL Prim wX wY -> Maybe (FL Prim wX wY) Source #

sortCoalesceFL :: FL Prim wX wY -> FL Prim wX wY Source #

canonize :: DiffAlgorithm -> Prim wX wY -> FL Prim wX wY Source #

canonizeFL :: DiffAlgorithm -> FL Prim wX wY -> FL Prim wX wY Source #

coalesce :: (Prim :> Prim) wX wY -> Maybe (FL Prim wX wY) Source #

PrimCanonize Prim Source # 
Instance details

Defined in Darcs.Patch.V1.Prim

Methods

tryToShrink :: FL Prim wX wY -> FL Prim wX wY Source #

tryShrinkingInverse :: FL Prim wX wY -> Maybe (FL Prim wX wY) Source #

sortCoalesceFL :: FL Prim wX wY -> FL Prim wX wY Source #

canonize :: DiffAlgorithm -> Prim wX wY -> FL Prim wX wY Source #

canonizeFL :: DiffAlgorithm -> FL Prim wX wY -> FL Prim wX wY Source #

coalesce :: (Prim :> Prim) wX wY -> Maybe (FL Prim wX wY) Source #

class PrimClassify prim where Source #

Methods

primIsAddfile :: prim wX wY -> Bool Source #

primIsRmfile :: prim wX wY -> Bool Source #

primIsAdddir :: prim wX wY -> Bool Source #

primIsRmdir :: prim wX wY -> Bool Source #

primIsMove :: prim wX wY -> Bool Source #

primIsHunk :: prim wX wY -> Bool Source #

primIsTokReplace :: prim wX wY -> Bool Source #

primIsBinary :: prim wX wY -> Bool Source #

primIsSetpref :: prim wX wY -> Bool Source #

is_filepatch :: prim wX wY -> Maybe FileName Source #

Instances
PrimClassify Prim Source # 
Instance details

Defined in Darcs.Patch.Prim.V1.Core

PrimClassify Prim Source # 
Instance details

Defined in Darcs.Patch.Prim.FileUUID.Core

PrimClassify Prim Source # 
Instance details

Defined in Darcs.Patch.V2.Prim

PrimClassify Prim Source # 
Instance details

Defined in Darcs.Patch.V1.Prim

class PrimDetails prim where Source #

Methods

summarizePrim :: prim wX wY -> [SummDetail] Source #

Instances
PrimDetails Prim Source # 
Instance details

Defined in Darcs.Patch.Prim.V1.Details

Methods

summarizePrim :: Prim wX wY -> [SummDetail] Source #

PrimDetails Prim Source # 
Instance details

Defined in Darcs.Patch.Prim.FileUUID.Details

Methods

summarizePrim :: Prim wX wY -> [SummDetail] Source #

PrimDetails Prim Source # 
Instance details

Defined in Darcs.Patch.V2.Prim

Methods

summarizePrim :: Prim wX wY -> [SummDetail] Source #

PrimDetails Prim Source # 
Instance details

Defined in Darcs.Patch.V1.Prim

Methods

summarizePrim :: Prim wX wY -> [SummDetail] Source #

class PrimShow prim where Source #

Methods

showPrim :: FileNameFormat -> prim wA wB -> Doc Source #

showPrimCtx :: ApplyMonad (ApplyState prim) m => FileNameFormat -> prim wA wB -> m Doc Source #

class PrimRead prim where Source #

Methods

readPrim :: ParserM m => FileNameFormat -> m (Sealed (prim wX)) Source #

Instances
PrimRead Prim Source # 
Instance details

Defined in Darcs.Patch.Prim.V1.Read

Methods

readPrim :: ParserM m => FileNameFormat -> m (Sealed (Prim wX)) Source #

PrimRead Prim Source # 
Instance details

Defined in Darcs.Patch.Prim.FileUUID.Read

Methods

readPrim :: ParserM m => FileNameFormat -> m (Sealed (Prim wX)) Source #

class PrimApply prim where Source #

Methods

applyPrimFL :: ApplyMonad (ApplyState prim) m => FL prim wX wY -> m () Source #

Instances
PrimApply Prim Source # 
Instance details

Defined in Darcs.Patch.Prim.V1.Apply

Methods

applyPrimFL :: ApplyMonad (ApplyState Prim) m => FL Prim wX wY -> m () Source #

PrimApply Prim Source # 
Instance details

Defined in Darcs.Patch.Prim.FileUUID.Apply

Methods

applyPrimFL :: ApplyMonad (ApplyState Prim) m => FL Prim wX wY -> m () Source #

PrimApply Prim Source # 
Instance details

Defined in Darcs.Patch.V2.Prim

Methods

applyPrimFL :: ApplyMonad (ApplyState Prim) m => FL Prim wX wY -> m () Source #

PrimApply Prim Source # 
Instance details

Defined in Darcs.Patch.V1.Prim

Methods

applyPrimFL :: ApplyMonad (ApplyState Prim) m => FL Prim wX wY -> m () Source #

class (PrimPatchCommon prim, ReadPatch prim, ShowPatch prim, ShowContextPatch prim, PatchListFormat prim) => PrimPatch prim Source #

Instances
PrimPatch Prim Source # 
Instance details

Defined in Darcs.Patch.Prim.FileUUID

PrimPatch Prim Source # 
Instance details

Defined in Darcs.Patch.V2.Prim

PrimPatch Prim Source # 
Instance details

Defined in Darcs.Patch.V1.Prim

class PrimPatch (PrimOf p) => PrimPatchBase p Source #

Associated Types

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

Instances
PrimPatchBase Prim Source # 
Instance details

Defined in Darcs.Patch.Prim.FileUUID

Associated Types

type PrimOf Prim :: Type -> Type -> Type Source #

PrimPatchBase Prim Source # 
Instance details

Defined in Darcs.Patch.V2.Prim

Associated Types

type PrimOf Prim :: Type -> Type -> Type Source #

PrimPatchBase Prim Source # 
Instance details

Defined in Darcs.Patch.V1.Prim

Associated Types

type PrimOf Prim :: Type -> Type -> Type Source #

PrimPatchBase DummyPatch Source # 
Instance details

Defined in Darcs.Patch.Dummy

Associated Types

type PrimOf DummyPatch :: Type -> Type -> Type Source #

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

Defined in Darcs.Patch.Prim.Class

Associated Types

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

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

Defined in Darcs.Patch.Prim.Class

Associated Types

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

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

Defined in Darcs.Patch.Bracketed.Instances

Associated Types

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

PrimPatch prim => PrimPatchBase (RepoPatchV1 prim) Source # 
Instance details

Defined in Darcs.Patch.V1.Core

Associated Types

type PrimOf (RepoPatchV1 prim) :: Type -> Type -> Type Source #

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

Defined in Darcs.Patch.Named

Associated Types

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

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

Defined in Darcs.Patch.Rebase.Name

Associated Types

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

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

Defined in Darcs.Patch.Rebase.Fixup

Associated Types

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

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

Defined in Darcs.Patch.Rebase.Container

Associated Types

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

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

Defined in Darcs.Patch.Rebase.Viewing

Associated Types

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

PrimPatch (PrimOf p) => PrimPatchBase (RebaseChange p) Source # 
Instance details

Defined in Darcs.Patch.Rebase.Viewing

Associated Types

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

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

Defined in Darcs.Patch.Rebase.Viewing

Associated Types

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

PrimPatch prim => PrimPatchBase (RepoPatchV2 prim) Source # 
Instance details

Defined in Darcs.Patch.V2.RepoPatch

Associated Types

type PrimOf (RepoPatchV2 prim) :: Type -> Type -> Type Source #

PrimPatchBase p => PrimPatchBase (WrappedNamed rt p) Source # 
Instance details

Defined in Darcs.Patch.Named.Wrapped

Associated Types

type PrimOf (WrappedNamed rt p) :: Type -> Type -> Type Source #

PrimPatchBase p => PrimPatchBase (PatchInfoAnd rt p) Source # 
Instance details

Defined in Darcs.Patch.PatchInfoAnd

Associated Types

type PrimOf (PatchInfoAnd rt p) :: Type -> Type -> Type Source #

class FromPrim p where Source #

Methods

fromPrim :: PrimOf p wX wY -> p wX wY Source #

Instances
FromPrim Prim Source # 
Instance details

Defined in Darcs.Patch.Prim.FileUUID

Methods

fromPrim :: PrimOf Prim wX wY -> Prim wX wY Source #

FromPrim Prim Source # 
Instance details

Defined in Darcs.Patch.V2.Prim

Methods

fromPrim :: PrimOf Prim wX wY -> Prim wX wY Source #

FromPrim Prim Source # 
Instance details

Defined in Darcs.Patch.V1.Prim

Methods

fromPrim :: PrimOf Prim wX wY -> Prim wX wY Source #

FromPrim DummyPatch Source # 
Instance details

Defined in Darcs.Patch.Dummy

Methods

fromPrim :: PrimOf DummyPatch wX wY -> DummyPatch wX wY Source #

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

Defined in Darcs.Patch.Prim.Class

Methods

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

FromPrim p => FromPrim (Bracketed p) Source # 
Instance details

Defined in Darcs.Patch.Bracketed.Instances

Methods

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

FromPrim (RepoPatchV1 prim) Source # 
Instance details

Defined in Darcs.Patch.V1.Core

Methods

fromPrim :: PrimOf (RepoPatchV1 prim) wX wY -> RepoPatchV1 prim wX wY Source #

FromPrim (RepoPatchV2 prim) Source # 
Instance details

Defined in Darcs.Patch.V2.RepoPatch

Methods

fromPrim :: PrimOf (RepoPatchV2 prim) wX wY -> RepoPatchV2 prim wX wY Source #

class FromPrims p where Source #

Methods

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

Instances
FromPrim p => FromPrims (RL p) Source # 
Instance details

Defined in Darcs.Patch.Prim.Class

Methods

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

FromPrim p => FromPrims (FL p) Source # 
Instance details

Defined in Darcs.Patch.Prim.Class

Methods

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

class FromPrim p => ToFromPrim p where Source #

Methods

toPrim :: p wX wY -> Maybe (PrimOf p wX wY) Source #

Instances
ToFromPrim Prim Source # 
Instance details

Defined in Darcs.Patch.V2.Prim

Methods

toPrim :: Prim wX wY -> Maybe (PrimOf Prim wX wY) Source #

ToFromPrim Prim Source # 
Instance details

Defined in Darcs.Patch.V1.Prim

Methods

toPrim :: Prim wX wY -> Maybe (PrimOf Prim wX wY) Source #

ToFromPrim (RepoPatchV2 prim) Source # 
Instance details

Defined in Darcs.Patch.V2.RepoPatch

Methods

toPrim :: RepoPatchV2 prim wX wY -> Maybe (PrimOf (RepoPatchV2 prim) wX wY) Source #

class (Apply prim, Commute prim, Invert prim, Eq2 prim, IsHunk prim, PatchInspect prim, RepairToFL prim, Show2 prim, PrimConstruct prim, PrimCanonize prim, PrimClassify prim, PrimDetails prim, PrimApply prim) => PrimPatchCommon prim Source #

This class describes the abstract interface to primitive patches that is indepenent of the on-disk format.

Instances
PrimPatchCommon Prim Source # 
Instance details

Defined in Darcs.Patch.Prim.V1

PrimPatchCommon Prim Source # 
Instance details

Defined in Darcs.Patch.Prim.FileUUID

PrimPatchCommon Prim Source # 
Instance details

Defined in Darcs.Patch.V2.Prim

PrimPatchCommon Prim Source # 
Instance details

Defined in Darcs.Patch.V1.Prim