darcs

Safe HaskellSafe-Infered

Darcs.Patch.Prim.Class

Documentation

class PrimConstruct prim where

Methods

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

Instances

class PrimCanonize prim where

Methods

tryToShrink :: FL prim -> FL prim

tryShrinkingInverse :: FL prim -> Maybe (FL prim)

sortCoalesceFL :: FL prim -> FL prim

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

canonize :: 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.

canonizeFL :: 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).

join :: (prim :> prim) -> Maybe (FL prim)

Instances

class PrimClassify prim where

Methods

primIsAddfile :: prim -> Bool

primIsRmfile :: prim -> Bool

primIsAdddir :: prim -> Bool

primIsRmdir :: prim -> Bool

primIsMove :: prim -> Bool

primIsHunk :: prim -> Bool

primIsTokReplace :: prim -> Bool

primIsBinary :: prim -> Bool

primIsSetpref :: prim -> Bool

is_filepatch :: prim -> Maybe FileName

Instances

class PrimDetails prim where

Methods

summarizePrim :: prim -> [SummDetail]

Instances

class PrimShow prim where

Methods

showPrim :: FileNameFormat -> prim -> Doc

Instances

showPrimFL :: PrimShow prim => FileNameFormat -> FL prim -> Doc

class PrimRead prim where

Methods

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

Instances

class PrimApply prim where

Methods

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

Instances

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

Instances

class FromPrim p where

Methods

fromPrim :: PrimOf p -> p

Instances

class FromPrims p where

Methods

fromPrims :: FL (PrimOf p) -> p

joinPatches :: FL p -> p

Instances

FromPrim p => FromPrims (RL p) 
FromPrim p => FromPrims (FL p) 

class FromPrim p => ToFromPrim p where

Methods

toPrim :: p -> Maybe (PrimOf p)

Instances