darcs-2.18.5: a distributed, interactive, smart revision control system

Safe Haskell | None
Language | Haskell2010

Darcs.Patch.Prim.Class

Synopsis

- class PrimConstruct (prim :: Type -> Type -> Type) 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 :: Type -> Type -> Type) 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 :: Type -> Type -> Type) where
  - summarizePrim :: prim wX wY -> [SummDetail]
- class PrimSift (prim :: Type -> Type -> Type) where
  - primIsSiftable :: prim wX wY -> Bool
- class PrimShow (prim :: Type -> Type -> Type) where
  - showPrim :: FileNameFormat -> prim wA wB -> Doc
  - showPrimWithContextAndApply :: ApplyMonad (ApplyState prim) m => FileNameFormat -> prim wA wB -> m Doc
- class PrimRead (prim :: Type -> Type -> Type) where
  - readPrim :: FileNameFormat -> Parser (Sealed (prim wX))
- class PrimApply (prim :: Type -> Type -> Type) where
  - applyPrimFL :: ApplyMonad (ApplyState prim) m => FL prim wX wY -> m ()
- type PrimPatch (prim :: Type -> Type -> Type) = (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 :: Type -> Type -> Type) where
  - mangleUnravelled :: Unravelled prim wX -> Maybe (Mangled prim wX)
- type Mangled (prim :: Type -> Type -> Type) wX = Sealed (FL prim wX)
- type Unravelled (prim :: Type -> Type -> Type) wX = [Sealed (FL prim wX)]
- primCleanMerge :: forall (prim :: Type -> Type -> Type). (Commute prim, Invert prim) => PartialMergeFn prim prim

# Documentation

class PrimConstruct (prim :: Type -> Type -> Type) where #

Methods

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 #

#### Instances

Instances details

PrimConstruct Prim # |
Instance details Defined in Darcs.Patch.Prim.FileUUID.Core Methods 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 #
ObjectIdOf (ApplyState Prim) ~ AnchoredPath => PrimConstruct Prim # |
Instance details Defined in Darcs.Patch.Prim.V1.Core Methods 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 #
PrimConstruct Prim # |
Instance details Defined in Darcs.Patch.V1.Prim Methods 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 #
PrimConstruct Prim # |
Instance details Defined in Darcs.Patch.V2.Prim Methods 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 :: Type -> Type -> Type) where #

Methods

tryToShrink :: FL prim wX wY -> Maybe (FL prim wX wY) #

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 #

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) #

Coalesce adjacent patches to one with the same effect.

    apply (primCoalesce p q) == apply p >> apply q

isIdentity :: prim wX wY -> EqCheck wX wY #

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 #

Provide a total order between arbitrary patches that is consistent with `Eq2`:

    unsafeCompare p q == IsEq  <=>  comparePrim p q == EQ

#### Instances

Instances details

PrimCoalesce Prim # |
Instance details Defined in Darcs.Patch.Prim.FileUUID.Coalesce Methods 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 #
PrimCoalesce Prim # |
Instance details Defined in Darcs.Patch.Prim.V1.Coalesce Methods 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 #
PrimCoalesce Prim # |
Instance details Defined in Darcs.Patch.V1.Prim Methods 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 #
PrimCoalesce Prim # |
Instance details Defined in Darcs.Patch.V2.Prim Methods 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 :: Type -> Type -> Type) where #

Methods

summarizePrim :: prim wX wY -> [SummDetail] #

#### Instances

Instances details

PrimDetails Prim # |
Instance details Defined in Darcs.Patch.Prim.FileUUID.Details Methods summarizePrim :: Prim wX wY -> [SummDetail] #
PrimDetails Prim # |
Instance details Defined in Darcs.Patch.Prim.V1.Details Methods summarizePrim :: Prim wX wY -> [SummDetail] #
PrimDetails Prim # |
Instance details Defined in Darcs.Patch.V1.Prim Methods summarizePrim :: Prim wX wY -> [SummDetail] #
PrimDetails Prim # |
Instance details Defined in Darcs.Patch.V2.Prim Methods summarizePrim :: Prim wX wY -> [SummDetail] #
PrimDetails p => PrimDetails (PrimWithName name p) # |
Instance details Defined in Darcs.Patch.Prim.WithName Methods summarizePrim :: PrimWithName name p wX wY -> [SummDetail] #

class PrimSift (prim :: Type -> Type -> Type) where #

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.

Methods

primIsSiftable :: prim wX wY -> Bool #

Whether a prim is a candidate for sifting

#### Instances

Instances details

PrimSift Prim # |
Instance details Defined in Darcs.Patch.Prim.FileUUID.Coalesce Methods primIsSiftable :: Prim wX wY -> Bool #
PrimSift Prim # |
Instance details Defined in Darcs.Patch.Prim.V1.Core Methods primIsSiftable :: Prim wX wY -> Bool #
PrimSift Prim # |
Instance details Defined in Darcs.Patch.V1.Prim Methods primIsSiftable :: Prim wX wY -> Bool #
PrimSift Prim # |
Instance details Defined in Darcs.Patch.V2.Prim Methods primIsSiftable :: Prim wX wY -> Bool #

class PrimShow (prim :: Type -> Type -> Type) where #

Methods

showPrim :: FileNameFormat -> prim wA wB -> Doc #

showPrimWithContextAndApply :: ApplyMonad (ApplyState prim) m => FileNameFormat -> prim wA wB -> m Doc #

#### Instances

Instances details

PrimShow Prim # |
Instance details Defined in Darcs.Patch.Prim.FileUUID.Show Methods showPrim :: FileNameFormat -> Prim wA wB -> Doc # showPrimWithContextAndApply :: ApplyMonad (ApplyState Prim) m => FileNameFormat -> Prim wA wB -> m Doc #
(Apply Prim, ApplyState Prim ~ Tree, ObjectIdOfPatch Prim ~ AnchoredPath) => PrimShow Prim # |
Instance details Defined in Darcs.Patch.Prim.V1.Show Methods showPrim :: FileNameFormat -> Prim wA wB -> Doc # showPrimWithContextAndApply :: ApplyMonad (ApplyState Prim) m => FileNameFormat -> Prim wA wB -> m Doc #

class PrimRead (prim :: Type -> Type -> Type) where #

Methods

readPrim :: FileNameFormat -> Parser (Sealed (prim wX)) #

#### Instances

Instances details

PrimRead Prim # |
Instance details Defined in Darcs.Patch.Prim.FileUUID.Read Methods readPrim :: FileNameFormat -> Parser (Sealed (Prim wX)) #
PrimRead Prim # |
Instance details Defined in Darcs.Patch.Prim.V1.Read Methods readPrim :: FileNameFormat -> Parser (Sealed (Prim wX)) #

class PrimApply (prim :: Type -> Type -> Type) where #

Methods

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

#### Instances

Instances details

PrimApply Prim # |
Instance details Defined in Darcs.Patch.Prim.FileUUID.Apply Methods applyPrimFL :: ApplyMonad (ApplyState Prim) m => FL Prim wX wY -> m () #
PrimApply Prim # |
Instance details Defined in Darcs.Patch.Prim.V1.Apply Methods applyPrimFL :: ApplyMonad (ApplyState Prim) m => FL Prim wX wY -> m () #
PrimApply Prim # |
Instance details Defined in Darcs.Patch.V1.Prim Methods applyPrimFL :: ApplyMonad (ApplyState Prim) m => FL Prim wX wY -> m () #
PrimApply Prim # |
Instance details Defined in Darcs.Patch.V2.Prim Methods applyPrimFL :: ApplyMonad (ApplyState Prim) m => FL Prim wX wY -> m () #
PrimApply p => PrimApply (PrimWithName name p) # |
Instance details Defined in Darcs.Patch.Prim.WithName Methods applyPrimFL :: ApplyMonad (ApplyState (PrimWithName name p)) m => FL (PrimWithName name p) wX wY -> m () #

type PrimPatch (prim :: Type -> Type -> Type) = (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 :: Type -> Type -> Type) where #

Methods

mangleUnravelled :: Unravelled prim wX -> Maybe (Mangled prim wX) #

Mangle conflicting alternatives if possible.

#### Instances

Instances details

PrimMangleUnravelled Prim # |
Instance details Defined in Darcs.Patch.Prim.FileUUID Methods mangleUnravelled :: Unravelled Prim wX -> Maybe (Mangled Prim wX) #
PrimMangleUnravelled Prim # |
Instance details Defined in Darcs.Patch.Prim.V1.Mangle Methods mangleUnravelled :: Unravelled Prim wX -> Maybe (Mangled Prim wX) #
PrimMangleUnravelled Prim # |
Instance details Defined in Darcs.Patch.V1.Prim Methods mangleUnravelled :: Unravelled Prim wX -> Maybe (Mangled Prim wX) #
PrimMangleUnravelled Prim # |
Instance details Defined in Darcs.Patch.V2.Prim Methods mangleUnravelled :: Unravelled Prim wX -> Maybe (Mangled Prim wX) #

type Mangled (prim :: Type -> Type -> Type) wX = Sealed (FL prim wX) #

Result of mangling a single Unravelled.

type Unravelled (prim :: Type -> Type -> Type) wX = [Sealed (FL prim wX)] #

A list of conflicting alternatives. They form a connected component of the conflict graph i.e. one transitive conflict.

primCleanMerge :: forall (prim :: Type -> Type -> Type). (Commute prim, Invert prim) => PartialMergeFn prim prim #