Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Darcs.Patch.Prim.Class
Synopsis
- 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 (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 PrimDetails prim where
- summarizePrim :: prim wX wY -> [SummDetail]
- class PrimSift prim where
- primIsSiftable :: prim wX wY -> Bool
- class PrimShow prim where
- showPrim :: FileNameFormat -> prim wA wB -> Doc
- showPrimWithContextAndApply :: ApplyMonad (ApplyState prim) m => FileNameFormat -> prim wA wB -> m Doc
- class PrimRead prim where
- readPrim :: FileNameFormat -> Parser (Sealed (prim wX))
- class PrimApply prim where
- applyPrimFL :: ApplyMonad (ApplyState prim) m => FL prim wX wY -> m ()
- 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 PrimMangleUnravelled prim where
- mangleUnravelled :: Unravelled prim wX -> Maybe (Mangled prim wX)
- type Mangled prim wX = Sealed (FL prim wX)
- type Unravelled prim wX = [Sealed (FL prim wX)]
- primCleanMerge :: (Commute prim, Invert prim) => PartialMergeFn prim prim
Documentation
class PrimConstruct prim where Source #
Methods
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 (Commute prim, Eq2 prim, Invert prim) => PrimCoalesce prim where Source #
Methods
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 PrimDetails prim where Source #
Methods
summarizePrim :: prim wX wY -> [SummDetail] Source #
Instances
PrimDetails Prim Source # | |
Defined in Darcs.Patch.Prim.FileUUID.Details Methods summarizePrim :: Prim wX wY -> [SummDetail] Source # | |
PrimDetails Prim Source # | |
Defined in Darcs.Patch.Prim.V1.Details Methods summarizePrim :: Prim wX wY -> [SummDetail] Source # | |
PrimDetails Prim Source # | |
Defined in Darcs.Patch.V1.Prim Methods summarizePrim :: Prim wX wY -> [SummDetail] Source # | |
PrimDetails Prim Source # | |
Defined in Darcs.Patch.V2.Prim Methods summarizePrim :: Prim wX wY -> [SummDetail] Source # | |
PrimDetails p => PrimDetails (PrimWithName name p) Source # | |
Defined in Darcs.Patch.Prim.WithName Methods summarizePrim :: PrimWithName name p wX wY -> [SummDetail] 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.
Instances
PrimSift Prim Source # | |
Defined in Darcs.Patch.Prim.FileUUID.Coalesce Methods primIsSiftable :: Prim wX wY -> Bool Source # | |
PrimSift Prim Source # | |
Defined in Darcs.Patch.Prim.V1.Core Methods primIsSiftable :: Prim wX wY -> Bool Source # | |
PrimSift Prim Source # | |
Defined in Darcs.Patch.V1.Prim Methods primIsSiftable :: Prim wX wY -> Bool Source # | |
PrimSift Prim Source # | |
Defined in Darcs.Patch.V2.Prim Methods primIsSiftable :: Prim wX wY -> Bool Source # |
class PrimShow prim where Source #
Methods
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 Methods 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 Methods showPrim :: FileNameFormat -> Prim wA wB -> Doc Source # showPrimWithContextAndApply :: ApplyMonad (ApplyState Prim) m => FileNameFormat -> Prim wA wB -> m Doc Source # |
class PrimApply prim where Source #
Methods
applyPrimFL :: ApplyMonad (ApplyState prim) m => FL prim wX wY -> m () Source #
Instances
PrimApply Prim Source # | |
Defined in Darcs.Patch.Prim.FileUUID.Apply Methods applyPrimFL :: ApplyMonad (ApplyState Prim) m => FL Prim wX wY -> m () Source # | |
PrimApply Prim Source # | |
Defined in Darcs.Patch.Prim.V1.Apply Methods applyPrimFL :: ApplyMonad (ApplyState Prim) m => FL Prim wX wY -> m () Source # | |
PrimApply Prim Source # | |
Defined in Darcs.Patch.V1.Prim Methods applyPrimFL :: ApplyMonad (ApplyState Prim) m => FL Prim wX wY -> m () Source # | |
PrimApply Prim Source # | |
Defined in Darcs.Patch.V2.Prim Methods applyPrimFL :: ApplyMonad (ApplyState Prim) m => FL Prim wX wY -> m () Source # | |
PrimApply p => PrimApply (PrimWithName name p) Source # | |
Defined in Darcs.Patch.Prim.WithName Methods applyPrimFL :: ApplyMonad (ApplyState (PrimWithName name p)) m => FL (PrimWithName name p) wX wY -> m () 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 PrimMangleUnravelled prim where Source #
Methods
mangleUnravelled :: Unravelled prim wX -> Maybe (Mangled prim wX) Source #
Mangle conflicting alternatives if possible.
Instances
PrimMangleUnravelled Prim Source # | |
Defined in Darcs.Patch.Prim.FileUUID Methods mangleUnravelled :: Unravelled Prim wX -> Maybe (Mangled Prim wX) Source # | |
PrimMangleUnravelled Prim Source # | |
Defined in Darcs.Patch.Prim.V1.Mangle Methods mangleUnravelled :: Unravelled Prim wX -> Maybe (Mangled Prim wX) Source # | |
PrimMangleUnravelled Prim Source # | |
Defined in Darcs.Patch.V1.Prim Methods mangleUnravelled :: Unravelled Prim wX -> Maybe (Mangled Prim wX) Source # | |
PrimMangleUnravelled Prim Source # | |
Defined in Darcs.Patch.V2.Prim Methods mangleUnravelled :: Unravelled Prim wX -> Maybe (Mangled Prim wX) 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.
primCleanMerge :: (Commute prim, Invert prim) => PartialMergeFn prim prim Source #