Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- class PrimApply prim where
- applyPrimFL :: ApplyMonad (ApplyState prim) m => FL prim wX wY -> m ()
- class (Commute prim, Eq2 prim, Invert prim) => PrimCoalesce prim where
- tryToShrink :: FL prim wX wY -> Maybe (FL prim wX wY)
- sortCoalesceFL :: FL prim wX wY -> FL prim wX wY
- primCoalesce :: prim wX wY -> prim wY wZ -> Maybe (prim wX wZ)
- isIdentity :: prim wX wY -> EqCheck wX wY
- comparePrim :: prim wA wB -> prim wC wD -> Ordering
- class PrimConstruct prim where
- addfile :: AnchoredPath -> prim wX wY
- rmfile :: AnchoredPath -> prim wX wY
- adddir :: AnchoredPath -> prim wX wY
- rmdir :: AnchoredPath -> prim wX wY
- move :: AnchoredPath -> AnchoredPath -> prim wX wY
- changepref :: String -> String -> String -> prim wX wY
- hunk :: AnchoredPath -> Int -> [ByteString] -> [ByteString] -> prim wX wY
- tokreplace :: AnchoredPath -> String -> String -> String -> prim wX wY
- binary :: AnchoredPath -> ByteString -> ByteString -> prim wX wY
- primFromHunk :: FileHunk (ObjectIdOfPatch prim) wX wY -> prim wX wY
- class PrimDetails prim where
- summarizePrim :: prim wX wY -> [SummDetail]
- class PrimMangleUnravelled prim where
- mangleUnravelled :: Unravelled prim wX -> Maybe (Mangled prim wX)
- type PrimPatch prim = (Annotate prim, Apply prim, CleanMerge prim, Commute prim, Invert prim, Eq2 prim, IsHunk prim, PatchInspect prim, RepairToFL prim, Show2 prim, PrimConstruct prim, PrimCoalesce prim, PrimDetails prim, PrimApply prim, PrimSift prim, PrimMangleUnravelled prim, ReadPatch prim, ShowPatch prim, ShowContextPatch prim, PatchListFormat prim)
- class PrimRead prim where
- readPrim :: FileNameFormat -> Parser (Sealed (prim wX))
- class PrimShow prim where
- showPrim :: FileNameFormat -> prim wA wB -> Doc
- showPrimWithContextAndApply :: ApplyMonad (ApplyState prim) m => FileNameFormat -> prim wA wB -> m Doc
- class PrimSift prim where
- primIsSiftable :: prim wX wY -> Bool
- type Mangled prim wX = Sealed (FL prim wX)
- type Unravelled prim wX = [Sealed (FL prim wX)]
- canonizeFL :: (IsHunk prim, PrimCoalesce prim, PrimConstruct prim) => DiffAlgorithm -> FL prim wX wY -> FL prim wX wY
- coalesce :: PrimCoalesce prim => (prim :> prim) wX wY -> Maybe (Maybe2 prim wX wY)
Documentation
class PrimApply prim where Source #
applyPrimFL :: ApplyMonad (ApplyState prim) m => FL prim wX wY -> m () Source #
Instances
PrimApply Prim Source # | |
Defined in Darcs.Patch.Prim.FileUUID.Apply applyPrimFL :: ApplyMonad (ApplyState Prim) m => FL Prim wX wY -> m () Source # | |
PrimApply Prim Source # | |
Defined in Darcs.Patch.Prim.V1.Apply applyPrimFL :: ApplyMonad (ApplyState Prim) m => FL Prim wX wY -> m () Source # | |
PrimApply Prim Source # | |
Defined in Darcs.Patch.V1.Prim applyPrimFL :: ApplyMonad (ApplyState Prim) m => FL Prim wX wY -> m () Source # | |
PrimApply Prim Source # | |
Defined in Darcs.Patch.V2.Prim applyPrimFL :: ApplyMonad (ApplyState Prim) m => FL Prim wX wY -> m () Source # | |
PrimApply p => PrimApply (PrimWithName name p) Source # | |
Defined in Darcs.Patch.Prim.WithName applyPrimFL :: ApplyMonad (ApplyState (PrimWithName name p)) m => FL (PrimWithName name p) wX wY -> m () Source # |
class (Commute prim, Eq2 prim, Invert prim) => PrimCoalesce prim where Source #
tryToShrink :: FL prim wX wY -> Maybe (FL prim wX wY) Source #
Try to shrink the input sequence by getting rid of self-cancellations
and identity patches or by coalescing patches. Also sort patches
according to some internally defined order (specific to the patch type)
as far as possible while respecting dependencies.
A result of Nothing
means that we could not shrink the input.
This method is included in the class for optimization. Instances are free
to use defaultTryToShrink
.
sortCoalesceFL :: FL prim wX wY -> FL prim wX wY Source #
This is similar to tryToShrink
but always gives back a result: if the
sequence could not be shrunk we merely give back a sorted version.
This method is included in the class for optimization. Instances are free
to use defaultSortCoalesceFL
.
primCoalesce :: prim wX wY -> prim wY wZ -> Maybe (prim wX wZ) Source #
Coalesce adjacent patches to one with the same effect.
apply (primCoalesce p q) == apply p >> apply q
isIdentity :: prim wX wY -> EqCheck wX wY Source #
Whether prim patch has no effect at all and thus can be eliminated as far as coalescing is concerned.
comparePrim :: prim wA wB -> prim wC wD -> Ordering Source #
Provide a total order between arbitrary patches that is consistent
with Eq2
:
unsafeCompare p q == IsEq <=> comparePrim p q == EQ
Instances
class PrimConstruct prim where Source #
addfile :: AnchoredPath -> prim wX wY Source #
rmfile :: AnchoredPath -> prim wX wY Source #
adddir :: AnchoredPath -> prim wX wY Source #
rmdir :: AnchoredPath -> prim wX wY Source #
move :: AnchoredPath -> AnchoredPath -> prim wX wY Source #
changepref :: String -> String -> String -> prim wX wY Source #
hunk :: AnchoredPath -> Int -> [ByteString] -> [ByteString] -> prim wX wY Source #
tokreplace :: AnchoredPath -> String -> String -> String -> prim wX wY Source #
binary :: AnchoredPath -> ByteString -> ByteString -> prim wX wY Source #
primFromHunk :: FileHunk (ObjectIdOfPatch prim) wX wY -> prim wX wY Source #
Instances
class PrimDetails prim where Source #
summarizePrim :: prim wX wY -> [SummDetail] Source #
Instances
PrimDetails Prim Source # | |
Defined in Darcs.Patch.Prim.FileUUID.Details summarizePrim :: Prim wX wY -> [SummDetail] Source # | |
PrimDetails Prim Source # | |
Defined in Darcs.Patch.Prim.V1.Details summarizePrim :: Prim wX wY -> [SummDetail] Source # | |
PrimDetails Prim Source # | |
Defined in Darcs.Patch.V1.Prim summarizePrim :: Prim wX wY -> [SummDetail] Source # | |
PrimDetails Prim Source # | |
Defined in Darcs.Patch.V2.Prim summarizePrim :: Prim wX wY -> [SummDetail] Source # | |
PrimDetails p => PrimDetails (PrimWithName name p) Source # | |
Defined in Darcs.Patch.Prim.WithName summarizePrim :: PrimWithName name p wX wY -> [SummDetail] Source # |
class PrimMangleUnravelled prim where Source #
mangleUnravelled :: Unravelled prim wX -> Maybe (Mangled prim wX) Source #
Mangle conflicting alternatives if possible.
Instances
PrimMangleUnravelled Prim Source # | |
Defined in Darcs.Patch.Prim.FileUUID mangleUnravelled :: Unravelled Prim wX -> Maybe (Mangled Prim wX) Source # | |
PrimMangleUnravelled Prim Source # | |
Defined in Darcs.Patch.Prim.V1.Mangle mangleUnravelled :: Unravelled Prim wX -> Maybe (Mangled Prim wX) Source # | |
PrimMangleUnravelled Prim Source # | |
Defined in Darcs.Patch.V1.Prim mangleUnravelled :: Unravelled Prim wX -> Maybe (Mangled Prim wX) Source # | |
PrimMangleUnravelled Prim Source # | |
Defined in Darcs.Patch.V2.Prim mangleUnravelled :: Unravelled Prim wX -> Maybe (Mangled Prim wX) Source # |
type PrimPatch prim = (Annotate prim, Apply prim, CleanMerge prim, Commute prim, Invert prim, Eq2 prim, IsHunk prim, PatchInspect prim, RepairToFL prim, Show2 prim, PrimConstruct prim, PrimCoalesce prim, PrimDetails prim, PrimApply prim, PrimSift prim, PrimMangleUnravelled prim, ReadPatch prim, ShowPatch prim, ShowContextPatch prim, PatchListFormat prim) Source #
class PrimShow prim where Source #
showPrim :: FileNameFormat -> prim wA wB -> Doc Source #
showPrimWithContextAndApply :: ApplyMonad (ApplyState prim) m => FileNameFormat -> prim wA wB -> m Doc Source #
Instances
PrimShow Prim Source # | |
Defined in Darcs.Patch.Prim.FileUUID.Show showPrim :: FileNameFormat -> Prim wA wB -> Doc Source # showPrimWithContextAndApply :: ApplyMonad (ApplyState Prim) m => FileNameFormat -> Prim wA wB -> m Doc Source # | |
(Apply Prim, ApplyState Prim ~ Tree, ObjectIdOfPatch Prim ~ AnchoredPath) => PrimShow Prim Source # | |
Defined in Darcs.Patch.Prim.V1.Show showPrim :: FileNameFormat -> Prim wA wB -> Doc Source # showPrimWithContextAndApply :: ApplyMonad (ApplyState Prim) m => FileNameFormat -> Prim wA wB -> m Doc Source # |
class PrimSift prim where Source #
Prim patches that support "sifting". This is the process of eliminating changes from a sequence of prims that can be recovered by comparing states (normally the pristine and working states), except those that other changes depend on. In other words, changes to the content of (tracked) files. The implementation is allowed and expected to shrink and coalesce changes in the process.
primIsSiftable :: prim wX wY -> Bool Source #
Whether a prim is a candidate for sifting
Instances
PrimSift Prim Source # | |
Defined in Darcs.Patch.Prim.FileUUID.Coalesce primIsSiftable :: Prim wX wY -> Bool Source # | |
PrimSift Prim Source # | |
Defined in Darcs.Patch.Prim.V1.Core primIsSiftable :: Prim wX wY -> Bool Source # | |
PrimSift Prim Source # | |
Defined in Darcs.Patch.V1.Prim primIsSiftable :: Prim wX wY -> Bool Source # | |
PrimSift Prim Source # | |
Defined in Darcs.Patch.V2.Prim primIsSiftable :: Prim wX wY -> Bool Source # |
type Unravelled prim wX = [Sealed (FL prim wX)] Source #
A list of conflicting alternatives. They form a connected component of the conflict graph i.e. one transitive conflict.
canonizeFL :: (IsHunk prim, PrimCoalesce prim, PrimConstruct prim) => DiffAlgorithm -> FL prim wX wY -> FL prim wX wY Source #
Put 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.
XXX Why not? How does it differ? The implementation for Prim.V1 does sortCoalesceFL and then invokes the diff algorithm for each hunk. How can that be any different to applying the sequence and then taking the diff? Is this merely because diff does not sort by file path?
Besides, diff and apply must be inverses in the sense that for any two states {start, end}, we have
diff start (apply (diff start end)) == end
coalesce :: PrimCoalesce prim => (prim :> prim) wX wY -> Maybe (Maybe2 prim wX wY) Source #
Either primCoalesce
or cancel inverses.
primCoalesce (p :> q) == Just r => apply r = apply p >> apply q