Safe Haskell | None |
---|---|
Language | Haskell2010 |
Darcs.Patch.Prim
- showPrim :: PrimShow prim => FileNameFormat -> prim wA wB -> Doc
- showPrimFL :: PrimShow prim => FileNameFormat -> FL prim wA wB -> Doc
- primIsAddfile :: PrimClassify prim => prim wX wY -> Bool
- primIsHunk :: PrimClassify prim => prim wX wY -> Bool
- primIsBinary :: PrimClassify prim => prim wX wY -> Bool
- primIsSetpref :: PrimClassify prim => prim wX wY -> Bool
- primIsAdddir :: PrimClassify prim => prim wX wY -> Bool
- is_filepatch :: PrimClassify prim => prim wX wY -> Maybe FileName
- canonize :: PrimCanonize prim => DiffAlgorithm -> prim wX wY -> FL prim wX wY
- tryToShrink :: PrimCanonize prim => FL prim wX wY -> FL prim wX wY
- sortCoalesceFL :: PrimCanonize prim => FL prim wX wY -> FL prim wX wY
- coalesce :: PrimCanonize prim => (prim :> prim) wX wY -> Maybe (FL prim wX wY)
- canonizeFL :: PrimCanonize prim => DiffAlgorithm -> FL prim wX wY -> FL prim wX wY
- tryShrinkingInverse :: PrimCanonize prim => FL prim wX wY -> Maybe (FL prim wX wY)
- summarizePrim :: PrimDetails prim => prim wX wY -> [SummDetail]
- applyPrimFL :: (PrimApply prim, ApplyMonad m (ApplyState prim)) => FL prim wX wY -> m ()
- readPrim :: (PrimRead prim, ParserM m) => FileNameFormat -> m (Sealed (prim wX))
- class FromPrim p where
- class FromPrims p where
- class FromPrim p => ToFromPrim p where
- class (Patchy prim, MyEq prim, PatchListFormat prim, IsHunk prim, RepairToFL prim, PatchInspect prim, ReadPatch prim, ShowPatch prim, PrimConstruct prim, PrimCanonize prim, PrimClassify prim, PrimDetails prim, PrimShow prim, PrimRead prim, PrimApply prim) => PrimPatch prim
- class PrimPatch (PrimOf p) => PrimPatchBase p where
- type PrimOf p :: * -> * -> *
- class PrimConstruct prim where
- 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
Documentation
showPrim :: PrimShow prim => FileNameFormat -> prim wA wB -> Doc
showPrimFL :: PrimShow prim => FileNameFormat -> FL prim wA wB -> Doc
primIsAddfile :: PrimClassify prim => prim wX wY -> Bool
primIsHunk :: PrimClassify prim => prim wX wY -> Bool
primIsBinary :: PrimClassify prim => prim wX wY -> Bool
primIsSetpref :: PrimClassify prim => prim wX wY -> Bool
primIsAdddir :: PrimClassify prim => prim wX wY -> Bool
is_filepatch :: PrimClassify prim => prim wX wY -> Maybe FileName
canonize :: PrimCanonize prim => 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.
tryToShrink :: PrimCanonize prim => 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?
sortCoalesceFL :: PrimCanonize prim => 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.
coalesce :: PrimCanonize prim => (prim :> prim) wX wY -> Maybe (FL prim wX wY)
canonizeFL :: PrimCanonize prim => 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).
tryShrinkingInverse :: PrimCanonize prim => 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
summarizePrim :: PrimDetails prim => prim wX wY -> [SummDetail]
applyPrimFL :: (PrimApply prim, ApplyMonad m (ApplyState prim)) => FL prim wX wY -> m ()
readPrim :: (PrimRead prim, ParserM m) => FileNameFormat -> m (Sealed (prim wX))
class FromPrim p where
class FromPrims p where
class FromPrim p => ToFromPrim p where
Instances
ToFromPrim (RealPatch prim) |
class (Patchy prim, MyEq prim, PatchListFormat prim, IsHunk prim, RepairToFL prim, PatchInspect prim, ReadPatch prim, ShowPatch 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 | |
PrimPatchBase p => PrimPatchBase (RL p) | |
PrimPatchBase p => PrimPatchBase (FL p) | |
PrimPatchBase p => PrimPatchBase (Named p) | |
PrimPatchBase p => PrimPatchBase (RebaseName p) | |
PrimPatchBase p => PrimPatchBase (RebaseFixup p) | |
PrimPatch prim => PrimPatchBase (Patch prim) | |
PrimPatch prim => PrimPatchBase (RealPatch prim) | |
PrimPatchBase p => PrimPatchBase (PatchInfoAnd p) | |
PrimPatchBase p => PrimPatchBase (Rebasing p) | |
PrimPatchBase p => PrimPatchBase (WithDroppedDeps p) | |
PrimPatch (PrimOf p) => PrimPatchBase (RebaseChange p) | |
PrimPatchBase p => PrimPatchBase (RebaseSelect p) |
class PrimConstruct prim where
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