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

Safe Haskell | None
Language | Haskell2010

Darcs.Patch.Invertible

Description

Formal inverses for patches that aren't really invertible. Note that most the mixed {`Fwd`,`Rev`} cases for `Commute` and `Eq2` are just errors.

Synopsis

- data Invertible (p :: Type -> Type -> Type) wX wY
- mkInvertible :: p wX wY -> Invertible p wX wY
- fromPositiveInvertible :: Invertible p wX wY -> p wX wY
- withInvertible :: (forall wA wB. p wA wB -> r) -> Invertible p wX wY -> r

# Documentation

data Invertible (p :: Type -> Type -> Type) wX wY #

Wrapper type to allow formal inversion of patches which aren't really invertible.

#### Instances

Instances details

Apply p => Apply (Invertible p) # |

Instance details

Defined in Darcs.Patch.Invertible

Associated Types

type ApplyState (Invertible p) |
Instance details Defined in Darcs.Patch.Invertible type ApplyState (Invertible p) = ApplyState p

Methods

apply :: ApplyMonad (ApplyState (Invertible p)) m => Invertible p wX wY -> m () #

unapply :: ApplyMonad (ApplyState (Invertible p)) m => Invertible p wX wY -> m () #

Commute p => Commute (Invertible p) # |
Instance details Defined in Darcs.Patch.Invertible Methods commute :: (Invertible p :> Invertible p) wX wY -> Maybe ((Invertible p :> Invertible p) wX wY) #
PatchListFormat p => PatchListFormat (Invertible p) # |
Instance details Defined in Darcs.Patch.Invertible Methods patchListFormat :: ListFormat (Invertible p) #
PrimPatchBase p => PrimPatchBase (Invertible p) # |

Instance details

Defined in Darcs.Patch.Invertible

Associated Types

type PrimOf (Invertible p) |
Instance details Defined in Darcs.Patch.Invertible type PrimOf (Invertible p) = PrimOf p

Ident p => Ident (Invertible p) # |
Instance details Defined in Darcs.Patch.Invertible Methods ident :: Invertible p wX wY -> PatchId (Invertible p) #
PatchInspect p => PatchInspect (Invertible p) # |
Instance details Defined in Darcs.Patch.Invertible Methods listTouchedFiles :: Invertible p wX wY -> [AnchoredPath] # hunkMatches :: (ByteString -> Bool) -> Invertible p wX wY -> Bool #
Invert (Invertible p) # |
Instance details Defined in Darcs.Patch.Invertible Methods invert :: Invertible p wX wY -> Invertible p wY wX #
ShowContextPatch p => ShowContextPatch (Invertible p) # |
Instance details Defined in Darcs.Patch.Invertible Methods showPatchWithContextAndApply :: ApplyMonad (ApplyState (Invertible p)) m => ShowPatchFor -> Invertible p wX wY -> m Doc #
ShowPatch p => ShowPatch (Invertible p) # |
Instance details Defined in Darcs.Patch.Invertible Methods content :: Invertible p wX wY -> Doc # description :: Invertible p wX wY -> Doc # summary :: Invertible p wX wY -> Doc # summaryFL :: FL (Invertible p) wX wY -> Doc # thing :: Invertible p wX wY -> String # things :: Invertible p wX wY -> String #
ShowPatchBasic p => ShowPatchBasic (Invertible p) # |
Instance details Defined in Darcs.Patch.Invertible Methods showPatch :: ShowPatchFor -> Invertible p wX wY -> Doc #
Eq2 p => Eq2 (Invertible p) # |
Instance details Defined in Darcs.Patch.Invertible Methods unsafeCompare :: Invertible p wA wB -> Invertible p wC wD -> Bool # (=\/=) :: Invertible p wA wB -> Invertible p wA wC -> EqCheck wB wC # (=/\=) :: Invertible p wA wC -> Invertible p wB wC -> EqCheck wA wB #
type ApplyState (Invertible p) # |
Instance details Defined in Darcs.Patch.Invertible type ApplyState (Invertible p) = ApplyState p
type PrimOf (Invertible p) # |
Instance details Defined in Darcs.Patch.Invertible type PrimOf (Invertible p) = PrimOf p
type PatchId (Invertible p) # |
Instance details Defined in Darcs.Patch.Invertible type PatchId (Invertible p)

mkInvertible :: p wX wY -> Invertible p wX wY #

Wrap a patch to make it (formally) `Invertible`. The result is initially positive i.e. `Fwd`.

fromPositiveInvertible :: Invertible p wX wY -> p wX wY #

Get the underlying patch from an `Invertible`, assuming (as a precondition) that it is positive i.e. `Fwd`.

withInvertible :: (forall wA wB. p wA wB -> r) -> Invertible p wX wY -> r #

Run a function on the patch inside an `Invertible`. The function has to be parametric in the witnesses, so we can run it with both a `Fwd` and a `Rev` patch.