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

Safe Haskell | None
Language | Haskell2010

Darcs.Patch.Prim.Class

# Documentation

class PrimConstruct prim where #

Minimal complete definition

addfile, rmfile, adddir, rmdir, move, changepref, hunk, tokreplace, binary, primFromHunk, anIdentity

Methods

addfile :: FilePath -> prim wX wY #

rmfile :: FilePath -> prim wX wY #

adddir :: FilePath -> prim wX wY #

rmdir :: FilePath -> prim wX wY #

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

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

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

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

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

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

anIdentity :: prim wX wX #

Instances

PrimConstruct Prim # |
Methods addfile :: FilePath -> Prim wX wY # rmfile :: FilePath -> Prim wX wY # adddir :: FilePath -> Prim wX wY # rmdir :: FilePath -> Prim wX wY # move :: FilePath -> FilePath -> Prim wX wY # changepref :: String -> String -> String -> Prim wX wY # hunk :: FilePath -> Int -> [ByteString] -> [ByteString] -> Prim wX wY # tokreplace :: FilePath -> String -> String -> String -> Prim wX wY # binary :: FilePath -> ByteString -> ByteString -> Prim wX wY # primFromHunk :: FileHunk wX wY -> Prim wX wY # anIdentity :: Prim wX wX #
PrimConstruct Prim # |
Methods addfile :: FilePath -> Prim wX wY # rmfile :: FilePath -> Prim wX wY # adddir :: FilePath -> Prim wX wY # rmdir :: FilePath -> Prim wX wY # move :: FilePath -> FilePath -> Prim wX wY # changepref :: String -> String -> String -> Prim wX wY # hunk :: FilePath -> Int -> [ByteString] -> [ByteString] -> Prim wX wY # tokreplace :: FilePath -> String -> String -> String -> Prim wX wY # binary :: FilePath -> ByteString -> ByteString -> Prim wX wY # primFromHunk :: FileHunk wX wY -> Prim wX wY # anIdentity :: Prim wX wX #

class PrimCanonize prim where #

Minimal complete definition

tryToShrink, tryShrinkingInverse, sortCoalesceFL, canonize, canonizeFL, coalesce

Methods

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

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

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

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

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 #

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

class PrimClassify prim where #

Minimal complete definition

primIsAddfile, primIsRmfile, primIsAdddir, primIsRmdir, primIsMove, primIsHunk, primIsTokReplace, primIsBinary, primIsSetpref, is_filepatch

Methods

primIsAddfile :: prim wX wY -> Bool #

primIsRmfile :: prim wX wY -> Bool #

primIsAdddir :: prim wX wY -> Bool #

primIsRmdir :: prim wX wY -> Bool #

primIsMove :: prim wX wY -> Bool #

primIsHunk :: prim wX wY -> Bool #

primIsTokReplace :: prim wX wY -> Bool #

primIsBinary :: prim wX wY -> Bool #

primIsSetpref :: prim wX wY -> Bool #

is_filepatch :: prim wX wY -> Maybe FileName #

Instances

PrimClassify Prim # |
Methods primIsAddfile :: Prim wX wY -> Bool # primIsRmfile :: Prim wX wY -> Bool # primIsAdddir :: Prim wX wY -> Bool # primIsRmdir :: Prim wX wY -> Bool # primIsMove :: Prim wX wY -> Bool # primIsHunk :: Prim wX wY -> Bool # primIsTokReplace :: Prim wX wY -> Bool # primIsBinary :: Prim wX wY -> Bool # primIsSetpref :: Prim wX wY -> Bool # is_filepatch :: Prim wX wY -> Maybe FileName #
PrimClassify Prim # |
Methods primIsAddfile :: Prim wX wY -> Bool # primIsRmfile :: Prim wX wY -> Bool # primIsAdddir :: Prim wX wY -> Bool # primIsRmdir :: Prim wX wY -> Bool # primIsMove :: Prim wX wY -> Bool # primIsHunk :: Prim wX wY -> Bool # primIsTokReplace :: Prim wX wY -> Bool # primIsBinary :: Prim wX wY -> Bool # primIsSetpref :: Prim wX wY -> Bool # is_filepatch :: Prim wX wY -> Maybe FileName #

class PrimDetails prim where #

Minimal complete definition

summarizePrim

Methods

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

class PrimShow prim where #

Minimal complete definition

showPrim

Methods

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

showPrimFL :: PrimShow prim => FileNameFormat -> FL prim wA wB -> Doc #

class PrimRead prim where #

Minimal complete definition

readPrim

Methods

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

class PrimApply prim where #

Minimal complete definition

applyPrimFL

Methods

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

class (Patchy prim, MyEq prim, PatchListFormat prim, IsHunk prim, RepairToFL prim, PatchInspect prim, ReadPatch prim, ShowPatch prim, Show2 prim, PrimConstruct prim, PrimCanonize prim, PrimClassify prim, PrimDetails prim, PrimShow prim, PrimRead prim, PrimApply prim) => PrimPatch prim #

class PrimPatch (PrimOf p) => PrimPatchBase p #

Associated Types

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

Instances

PrimPatchBase DummyPatch # |
Associated Types type PrimOf (DummyPatch :: * -> * -> *) :: * -> * -> * #
PrimPatchBase p => PrimPatchBase (RL p) # |
Associated Types type PrimOf (RL p :: * -> * -> *) :: * -> * -> * #
PrimPatchBase p => PrimPatchBase (FL p) # |
Associated Types type PrimOf (FL p :: * -> * -> *) :: * -> * -> * #
PrimPatch prim => PrimPatchBase (RepoPatchV1 prim) # |
Associated Types type PrimOf (RepoPatchV1 prim :: * -> * -> *) :: * -> * -> * #
PrimPatchBase p => PrimPatchBase (Named p) # |
Associated Types type PrimOf (Named p :: * -> * -> *) :: * -> * -> * #
PrimPatchBase p => PrimPatchBase (RebaseName p) # |
Associated Types type PrimOf (RebaseName p :: * -> * -> *) :: * -> * -> * #
PrimPatchBase p => PrimPatchBase (RebaseFixup p) # |
Associated Types type PrimOf (RebaseFixup p :: * -> * -> *) :: * -> * -> * #
PrimPatchBase p => PrimPatchBase (Suspended p) # |
Associated Types type PrimOf (Suspended p :: * -> * -> *) :: * -> * -> * #
PrimPatch prim => PrimPatchBase (RepoPatchV2 prim) # |
Associated Types type PrimOf (RepoPatchV2 prim :: * -> * -> *) :: * -> * -> * #
PrimPatchBase p => PrimPatchBase (WithDroppedDeps p) # |
Associated Types type PrimOf (WithDroppedDeps p :: * -> * -> *) :: * -> * -> * #
PrimPatch (PrimOf p) => PrimPatchBase (RebaseChange p) # |
Associated Types type PrimOf (RebaseChange p :: * -> * -> *) :: * -> * -> * #
PrimPatchBase p => PrimPatchBase (RebaseSelect p) # |
Associated Types type PrimOf (RebaseSelect p :: * -> * -> *) :: * -> * -> * #
PrimPatchBase p => PrimPatchBase (WrappedNamed rt p) # |
Associated Types type PrimOf (WrappedNamed rt p :: * -> * -> *) :: * -> * -> * #
PrimPatchBase p => PrimPatchBase (PatchInfoAnd rt p) # |
Associated Types type PrimOf (PatchInfoAnd rt p :: * -> * -> *) :: * -> * -> * #

class FromPrim p where #

Minimal complete definition

fromPrim

Methods

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

Instances

FromPrim DummyPatch # |
Methods fromPrim :: PrimOf DummyPatch wX wY -> DummyPatch wX wY #
FromPrim p => FromPrim (FL p) # |
Methods fromPrim :: PrimOf (FL p) wX wY -> FL p wX wY #
FromPrim (RepoPatchV1 prim) # |
Methods fromPrim :: PrimOf (RepoPatchV1 prim) wX wY -> RepoPatchV1 prim wX wY #
FromPrim (RepoPatchV2 prim) # |
Methods fromPrim :: PrimOf (RepoPatchV2 prim) wX wY -> RepoPatchV2 prim wX wY #

class FromPrims p where #

Minimal complete definition

fromPrims

Methods

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

Instances

FromPrim p => FromPrims (RL p) # |
Methods fromPrims :: FL (PrimOf (RL p)) wX wY -> RL p wX wY #
FromPrim p => FromPrims (FL p) # |
Methods fromPrims :: FL (PrimOf (FL p)) wX wY -> FL p wX wY #

class FromPrim p => ToFromPrim p where #

Minimal complete definition

toPrim

Methods

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

Instances

ToFromPrim (RepoPatchV2 prim) # |
Methods toPrim :: RepoPatchV2 prim wX wY -> Maybe (PrimOf (RepoPatchV2 prim) wX wY) #