Safe Haskell | Safe-Infered |
---|
Darcs.Patch.Prim
- showPrim :: PrimShow prim => FileNameFormat -> prim -> Doc
- showPrimFL :: PrimShow prim => FileNameFormat -> FL prim -> Doc
- primIsAddfile :: PrimClassify prim => prim -> Bool
- primIsHunk :: PrimClassify prim => prim -> Bool
- primIsBinary :: PrimClassify prim => prim -> Bool
- primIsSetpref :: PrimClassify prim => prim -> Bool
- primIsAdddir :: PrimClassify prim => prim -> Bool
- is_filepatch :: PrimClassify prim => prim -> Maybe FileName
- canonize :: PrimCanonize prim => prim -> FL prim
- tryToShrink :: PrimCanonize prim => FL prim -> FL prim
- sortCoalesceFL :: PrimCanonize prim => FL prim -> FL prim
- join :: PrimCanonize prim => (prim :> prim) -> Maybe (FL prim)
- canonizeFL :: PrimCanonize prim => FL prim -> FL prim
- tryShrinkingInverse :: PrimCanonize prim => FL prim -> Maybe (FL prim)
- summarizePrim :: PrimDetails prim => prim -> [SummDetail]
- applyPrimFL :: (PrimApply prim, ApplyMonad m (ApplyState prim)) => FL prim -> m ()
- readPrim :: (PrimRead prim, ParserM m) => FileNameFormat -> m (Sealed prim)
- class FromPrim p where
- class FromPrims p where
- fromPrims :: FL (PrimOf p) -> p
- joinPatches :: FL p -> p
- class FromPrim p => ToFromPrim p where
- class (Patchy prim, PatchListFormat prim, IsHunk prim, RepairToFL 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
- rmfile :: FilePath -> prim
- adddir :: FilePath -> prim
- rmdir :: FilePath -> prim
- move :: FilePath -> FilePath -> prim
- changepref :: String -> String -> String -> prim
- hunk :: FilePath -> Int -> [ByteString] -> [ByteString] -> prim
- tokreplace :: FilePath -> String -> String -> String -> prim
- binary :: FilePath -> ByteString -> ByteString -> prim
- primFromHunk :: FileHunk -> prim
- anIdentity :: prim
Documentation
showPrim :: PrimShow prim => FileNameFormat -> prim -> Doc
showPrimFL :: PrimShow prim => FileNameFormat -> FL prim -> Doc
primIsAddfile :: PrimClassify prim => prim -> Bool
primIsHunk :: PrimClassify prim => prim -> Bool
primIsBinary :: PrimClassify prim => prim -> Bool
primIsSetpref :: PrimClassify prim => prim -> Bool
primIsAdddir :: PrimClassify prim => prim -> Bool
is_filepatch :: PrimClassify prim => prim -> Maybe FileName
canonize :: PrimCanonize prim => prim -> FL prim
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 -> FL prim
sortCoalesceFL :: PrimCanonize prim => FL prim -> FL prim
sortCoalesceFL
ps
coalesces as many patches in ps
as
possible, sorting the results in some standard order.
join :: PrimCanonize prim => (prim :> prim) -> Maybe (FL prim)
canonizeFL :: PrimCanonize prim => FL prim -> FL prim
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 -> Maybe (FL prim)
summarizePrim :: PrimDetails prim => prim -> [SummDetail]
applyPrimFL :: (PrimApply prim, ApplyMonad m (ApplyState prim)) => FL prim -> m ()
readPrim :: (PrimRead prim, ParserM m) => FileNameFormat -> m (Sealed prim)
class FromPrim p where
class FromPrims p where
class FromPrim p => ToFromPrim p where
Instances
ToFromPrim (RealPatch prim) |
class (Patchy prim, PatchListFormat prim, IsHunk prim, RepairToFL 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 Prim | |
PrimPatchBase p => PrimPatchBase (RL p) | |
PrimPatchBase p => PrimPatchBase (FL p) | |
PrimPatch prim => PrimPatchBase (Patch prim) | |
PrimPatchBase p => PrimPatchBase (Named p) | |
PrimPatchBase p => PrimPatchBase (PatchInfoAnd p) | |
PrimPatch prim => PrimPatchBase (RealPatch prim) |
class PrimConstruct prim where
Methods
move :: FilePath -> FilePath -> prim
changepref :: String -> String -> String -> prim
hunk :: FilePath -> Int -> [ByteString] -> [ByteString] -> prim
tokreplace :: FilePath -> String -> String -> String -> prim
binary :: FilePath -> ByteString -> ByteString -> prim
primFromHunk :: FileHunk -> prim
anIdentity :: prim
Instances