Safe Haskell | None |
---|---|
Language | Haskell2010 |
Darcs.Patch.Prim.Class
Synopsis
- class PrimConstruct prim where
- class PrimCanonize prim where
- class PrimClassify prim where
- class PrimDetails prim where
- class PrimShow prim where
- class PrimRead prim where
- class PrimApply prim where
- class (PrimPatchCommon prim, ReadPatch prim, ShowPatch prim, ShowContextPatch prim, PatchListFormat prim) => PrimPatch prim
- class PrimPatch (PrimOf p) => PrimPatchBase p where
- class FromPrim p where
- class FromPrims p where
- class FromPrim p => ToFromPrim p where
- 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
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
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).
Instances
PrimCanonize Prim # | |
Defined in Darcs.Patch.Prim.V1.Coalesce | |
PrimCanonize Prim # | |
Defined in Darcs.Patch.Prim.FileUUID.Coalesce | |
PrimCanonize Prim # | |
Defined in Darcs.Patch.V2.Prim | |
PrimCanonize Prim # | |
Defined in Darcs.Patch.V1.Prim |
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
class PrimDetails prim where #
Minimal complete definition
Methods
summarizePrim :: prim wX wY -> [SummDetail] #
Instances
PrimDetails Prim # | |
Defined in Darcs.Patch.Prim.V1.Details Methods summarizePrim :: Prim wX wY -> [SummDetail] # | |
PrimDetails Prim # | |
Defined in Darcs.Patch.Prim.FileUUID.Details Methods summarizePrim :: Prim wX wY -> [SummDetail] # | |
PrimDetails Prim # | |
Defined in Darcs.Patch.V2.Prim Methods summarizePrim :: Prim wX wY -> [SummDetail] # | |
PrimDetails Prim # | |
Defined in Darcs.Patch.V1.Prim Methods summarizePrim :: Prim wX wY -> [SummDetail] # |
Minimal complete definition
Methods
showPrim :: FileNameFormat -> prim wA wB -> Doc #
showPrimCtx :: ApplyMonad (ApplyState prim) m => FileNameFormat -> prim wA wB -> m Doc #
Instances
ApplyState Prim ~ Tree => PrimShow Prim # | |
Defined in Darcs.Patch.Prim.V1.Show Methods showPrim :: FileNameFormat -> Prim wA wB -> Doc # showPrimCtx :: ApplyMonad (ApplyState Prim) m => FileNameFormat -> Prim wA wB -> m Doc # | |
PrimShow Prim # | |
Defined in Darcs.Patch.Prim.FileUUID.Show Methods showPrim :: FileNameFormat -> Prim wA wB -> Doc # showPrimCtx :: ApplyMonad (ApplyState Prim) m => FileNameFormat -> Prim wA wB -> m Doc # |
Minimal complete definition
Methods
readPrim :: ParserM m => FileNameFormat -> m (Sealed (prim wX)) #
Instances
PrimRead Prim # | |
Defined in Darcs.Patch.Prim.V1.Read | |
PrimRead Prim # | |
Defined in Darcs.Patch.Prim.FileUUID.Read |
Minimal complete definition
Methods
applyPrimFL :: ApplyMonad (ApplyState prim) m => FL prim wX wY -> m () #
Instances
PrimApply Prim # | |
Defined in Darcs.Patch.Prim.V1.Apply Methods applyPrimFL :: ApplyMonad (ApplyState Prim) m => FL Prim wX wY -> m () # | |
PrimApply Prim # | |
Defined in Darcs.Patch.Prim.FileUUID.Apply Methods applyPrimFL :: ApplyMonad (ApplyState Prim) m => FL Prim wX wY -> m () # | |
PrimApply Prim # | |
Defined in Darcs.Patch.V2.Prim Methods applyPrimFL :: ApplyMonad (ApplyState Prim) m => FL Prim wX wY -> m () # | |
PrimApply Prim # | |
Defined in Darcs.Patch.V1.Prim Methods applyPrimFL :: ApplyMonad (ApplyState Prim) m => FL Prim wX wY -> m () # |
class (PrimPatchCommon prim, ReadPatch prim, ShowPatch prim, ShowContextPatch prim, PatchListFormat prim) => PrimPatch prim #
Instances
PrimPatch Prim # | |
Defined in Darcs.Patch.Prim.FileUUID | |
PrimPatch Prim # | |
Defined in Darcs.Patch.V2.Prim | |
PrimPatch Prim # | |
Defined in Darcs.Patch.V1.Prim |
class PrimPatch (PrimOf p) => PrimPatchBase p #
Instances
Minimal complete definition
Instances
FromPrim Prim # | |
FromPrim Prim # | |
FromPrim Prim # | |
FromPrim DummyPatch # | |
Defined in Darcs.Patch.Dummy Methods fromPrim :: PrimOf DummyPatch wX wY -> DummyPatch wX wY # | |
FromPrim p => FromPrim (FL p) # | |
FromPrim p => FromPrim (Bracketed p) # | |
FromPrim (RepoPatchV1 prim) # | |
Defined in Darcs.Patch.V1.Core Methods fromPrim :: PrimOf (RepoPatchV1 prim) wX wY -> RepoPatchV1 prim wX wY # | |
FromPrim (RepoPatchV2 prim) # | |
Defined in Darcs.Patch.V2.RepoPatch Methods fromPrim :: PrimOf (RepoPatchV2 prim) wX wY -> RepoPatchV2 prim wX wY # |
Minimal complete definition
class FromPrim p => ToFromPrim p where #
Minimal complete definition
Instances
ToFromPrim Prim # | |
ToFromPrim Prim # | |
ToFromPrim (RepoPatchV2 prim) # | |
Defined in Darcs.Patch.V2.RepoPatch Methods toPrim :: RepoPatchV2 prim wX wY -> Maybe (PrimOf (RepoPatchV2 prim) wX wY) # |
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 #
This class describes the abstract interface to primitive patches that is indepenent of the on-disk format.
Instances
PrimPatchCommon Prim # | |
Defined in Darcs.Patch.Prim.V1 | |
PrimPatchCommon Prim # | |
Defined in Darcs.Patch.Prim.FileUUID | |
PrimPatchCommon Prim # | |
Defined in Darcs.Patch.V2.Prim | |
PrimPatchCommon Prim # | |
Defined in Darcs.Patch.V1.Prim |