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

Safe Haskell | None

Darcs.Patch.PatchInfoAnd

Synopsis

- data Hopefully a x y
- data PatchInfoAnd p a b
- data WPatchInfo a b
- unWPatchInfo :: WPatchInfo a b -> PatchInfo
- compareWPatchInfo :: WPatchInfo a b -> WPatchInfo c d -> EqCheck (a, b) (c, d)
- piap :: PatchInfo -> Named p a b -> PatchInfoAnd p a b
- n2pia :: Named p x y -> PatchInfoAnd p x y
- patchInfoAndPatch :: PatchInfo -> Hopefully (Named p) a b -> PatchInfoAnd p a b
- fmapPIAP :: (forall a b. p a b -> q a b) -> PatchInfoAnd p x y -> PatchInfoAnd q x y
- fmapFL_PIAP :: (FL p x y -> FL q x y) -> PatchInfoAnd p x y -> PatchInfoAnd q x y
- conscientiously :: (Doc -> Doc) -> PatchInfoAnd p a b -> Named p a b
- hopefully :: PatchInfoAnd p a b -> Named p a b
- info :: PatchInfoAnd p a b -> PatchInfo
- winfo :: PatchInfoAnd p a b -> WPatchInfo a b
- hopefullyM :: Monad m => PatchInfoAnd p a b -> m (Named p a b)
- createHashed :: String -> (String -> IO (Sealed (a x))) -> IO (Sealed (Hopefully a x))
- extractHash :: PatchInfoAnd p a b -> Either (Named p a b) String
- actually :: a x y -> Hopefully a x y
- unavailable :: String -> Hopefully a x y
- patchDesc :: forall p x y. PatchInfoAnd p x y -> String

# Documentation

data Hopefully a x y

``Hopefully` p C` `(x y)` is ``Either` String (p C` `(x y))` in a form adapted to darcs patches. The `C` `(x y)` represents the type witness for the patch that should be there. The `Hopefully` type just tells whether we expect the patch to be hashed or not, and `SimpleHopefully` does the real work of emulating `Either`. `Hopefully sh` represents an expected unhashed patch, and `Hashed hash sh` represents an expected hashed patch with its hash.

data PatchInfoAnd p a b

``PatchInfoAnd` p a b` represents a hope we have to get a patch through its info. We're not sure we have the patch, but we know its info.

Instances

PatchListFormat (PatchInfoAnd p) |
(Commute p, MyEq p) => MyEq (PatchInfoAnd p) |
Commute p => Commute (PatchInfoAnd p) |
(Commute p, Invert p) => Invert (PatchInfoAnd p) |
Merge p => Merge (PatchInfoAnd p) |
PatchInspect p => PatchInspect (PatchInfoAnd p) |
(ReadPatch p, PatchListFormat p) => ReadPatch (PatchInfoAnd p) |
Apply p => Apply (PatchInfoAnd p) |
RepairToFL p => Repair (PatchInfoAnd p) |
(Apply p, Conflict p, CommuteNoConflicts p, IsHunk p, PatchListFormat p, PrimPatchBase p, ShowPatch p, ~ ((* -> *) -> *) (ApplyState p) Tree) => ShowPatch (PatchInfoAnd p) |
(PatchListFormat p, ShowPatchBasic p) => ShowPatchBasic (PatchInfoAnd p) |
(RepoPatch p, ~ ((* -> *) -> *) (ApplyState p) Tree) => Patchy (PatchInfoAnd p) |
IsHunk (PatchInfoAnd p) |
PrimPatchBase p => PrimPatchBase (PatchInfoAnd p) |
Effect p => Effect (PatchInfoAnd p) |

data WPatchInfo a b

``WPatchInfo` a b` represents the info of a patch, marked with the patch's witnesses.

Instances

MyEq WPatchInfo |

unWPatchInfo :: WPatchInfo a b -> PatchInfo

compareWPatchInfo :: WPatchInfo a b -> WPatchInfo c d -> EqCheck (a, b) (c, d)

piap :: PatchInfo -> Named p a b -> PatchInfoAnd p a b

``piap` i p` creates a PatchInfoAnd containing p with info i.

n2pia :: Named p x y -> PatchInfoAnd p x y

`n2pia` creates a PatchInfoAnd representing a `Named` patch.

patchInfoAndPatch :: PatchInfo -> Hopefully (Named p) a b -> PatchInfoAnd p a b

fmapPIAP :: (forall a b. p a b -> q a b) -> PatchInfoAnd p x y -> PatchInfoAnd q x y

fmapFL_PIAP :: (FL p x y -> FL q x y) -> PatchInfoAnd p x y -> PatchInfoAnd q x y

conscientiously :: (Doc -> Doc) -> PatchInfoAnd p a b -> Named p a b

``conscientiously` er hp` tries to extract a patch from a `PatchInfoAnd`. If it fails, it applies the error handling function `er` to a description of the patch info component of `hp`.

hopefully :: PatchInfoAnd p a b -> Named p a b

``hopefully` hp` tries to get a patch from a `PatchInfoAnd` value. If it fails, it outputs an error "failed to read patch: <description of the patch>". We get the description of the patch from the info part of `hp`

info :: PatchInfoAnd p a b -> PatchInfo

winfo :: PatchInfoAnd p a b -> WPatchInfo a b

hopefullyM :: Monad m => PatchInfoAnd p a b -> m (Named p a b)

`hopefullyM` is a version of `hopefully` which calls `fail` in a monad instead of erroring.

createHashed :: String -> (String -> IO (Sealed (a x))) -> IO (Sealed (Hopefully a x))

extractHash :: PatchInfoAnd p a b -> Either (Named p a b) String

actually :: a x y -> Hopefully a x y

unavailable :: String -> Hopefully a x y

patchDesc :: forall p x y. PatchInfoAnd p x y -> String