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

Safe Haskell | None
Language | Haskell2010

Darcs.Patch.PatchInfoAnd

Synopsis

- data Hopefully a wX wY
  - = Hopefully (SimpleHopefully a wX wY)
  - | Hashed String (SimpleHopefully a wX wY)
- data SimpleHopefully a wX wY
  - = Actually (a wX wY)
  - | Unavailable String
- data PatchInfoAnd rt p wA wB = PIAP !PatchInfo (Hopefully (WrappedNamed rt p) wA wB)
- data WPatchInfo wA wB
- unWPatchInfo :: WPatchInfo wA wB -> PatchInfo
- compareWPatchInfo :: WPatchInfo wA wB -> WPatchInfo wC wD -> EqCheck (wA, wB) (wC, wD)
- piap :: PatchInfo -> WrappedNamed rt p wA wB -> PatchInfoAnd rt p wA wB
- n2pia :: WrappedNamed rt p wX wY -> PatchInfoAnd rt p wX wY
- patchInfoAndPatch :: PatchInfo -> Hopefully (WrappedNamed rt p) wA wB -> PatchInfoAnd rt p wA wB
- fmapFLPIAP :: (FL p wX wY -> FL q wX wY) -> ((RebaseTypeOf rt :~~: IsRebase) -> p :~: q) -> PatchInfoAnd rt p wX wY -> PatchInfoAnd rt q wX wY
- generaliseRepoTypePIAP :: PatchInfoAnd (RepoType NoRebase) p wA wB -> PatchInfoAnd rt p wA wB
- conscientiously :: (Doc -> Doc) -> PatchInfoAnd rt p wA wB -> WrappedNamed rt p wA wB
- hopefully :: PatchInfoAnd rt p wA wB -> WrappedNamed rt p wA wB
- info :: PatchInfoAnd rt p wA wB -> PatchInfo
- winfo :: PatchInfoAnd rt p wA wB -> WPatchInfo wA wB
- hopefullyM :: Monad m => PatchInfoAnd rt p wA wB -> m (WrappedNamed rt p wA wB)
- createHashed :: String -> (String -> IO (Sealed (a wX))) -> IO (Sealed (Hopefully a wX))
- extractHash :: PatchInfoAnd rt p wA wB -> Either (WrappedNamed rt p wA wB) String
- actually :: a wX wY -> Hopefully a wX wY
- unavailable :: String -> Hopefully a wX wY
- patchDesc :: forall rt p wX wY. PatchInfoAnd rt p wX wY -> String

# Documentation

data Hopefully a wX wY #

``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.

Constructors

Hopefully (SimpleHopefully a wX wY) |
Hashed String (SimpleHopefully a wX wY) |

Instances

Show (a wX wY) => Show (Hopefully a wX wY) # |
Methods showsPrec :: Int -> Hopefully a wX wY -> ShowS # show :: Hopefully a wX wY -> String # showList :: [Hopefully a wX wY] -> ShowS #

data SimpleHopefully a wX wY #

`SimpleHopefully` is a variant of `Either String` adapted for type witnesses. `Actually` is the equivalent of `Right`, while `Unavailable` is `Left`.

Constructors

Actually (a wX wY) |
Unavailable String |

Instances

Show (a wX wY) => Show (SimpleHopefully a wX wY) # |
Methods showsPrec :: Int -> SimpleHopefully a wX wY -> ShowS # show :: SimpleHopefully a wX wY -> String # showList :: [SimpleHopefully a wX wY] -> ShowS #

data PatchInfoAnd rt p wA wB #

``PatchInfoAnd` p wA wB` 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.

Constructors

PIAP !PatchInfo (Hopefully (WrappedNamed rt p) wA wB) |

Instances

Show2 p => Show2 (PatchInfoAnd rt p) # |
Methods showDict2 :: ShowDict (PatchInfoAnd rt p wX wY) #
MyEq (PatchInfoAnd rt p) # |
Methods unsafeCompare :: PatchInfoAnd rt p wA wB -> PatchInfoAnd rt p wC wD -> Bool # (=\/=) :: PatchInfoAnd rt p wA wB -> PatchInfoAnd rt p wA wC -> EqCheck wB wC # (=/\=) :: PatchInfoAnd rt p wA wC -> PatchInfoAnd rt p wB wC -> EqCheck wA wB #
PatchListFormat (PatchInfoAnd rt p) # |
Methods patchListFormat :: ListFormat (PatchInfoAnd rt p) #
Commute p => Commute (PatchInfoAnd rt p) # |
Methods commute :: (PatchInfoAnd rt p :> PatchInfoAnd rt p) wX wY -> Maybe ((PatchInfoAnd rt p :> PatchInfoAnd rt p) wX wY) #
PatchDebug p => PatchDebug (PatchInfoAnd rt p) # |
Methods patchDebugDummy :: PatchInfoAnd rt p wX wY -> () #
PatchInspect p => PatchInspect (PatchInfoAnd rt p) # |
Methods listTouchedFiles :: PatchInfoAnd rt p wX wY -> [FilePath] # hunkMatches :: (ByteString -> Bool) -> PatchInfoAnd rt p wX wY -> Bool #
Invert p => Invert (PatchInfoAnd rt p) # |
Methods invert :: PatchInfoAnd rt p wX wY -> PatchInfoAnd rt p wY wX #
Merge p => Merge (PatchInfoAnd rt p) # |
Methods merge :: (PatchInfoAnd rt p :\/: PatchInfoAnd rt p) wX wY -> (PatchInfoAnd rt p :/\: PatchInfoAnd rt p) wX wY #
(ReadPatch p, PatchListFormat p, PrimPatchBase p, Effect p, FromPrim p, IsRepoType rt) => ReadPatch (PatchInfoAnd rt p) # |
Methods readPatch' :: ParserM m => m (Sealed (PatchInfoAnd rt p wX)) #
Apply p => Apply (PatchInfoAnd rt p) # |
Associated Types type ApplyState (PatchInfoAnd rt p :: * -> * -> *) :: (* -> *) -> * # Methods apply :: ApplyMonad (ApplyState (PatchInfoAnd rt p)) m => PatchInfoAnd rt p wX wY -> m () #
RepairToFL p => Repair (PatchInfoAnd rt p) # |
Methods applyAndTryToFix :: ApplyMonad (ApplyState (PatchInfoAnd rt p)) m => PatchInfoAnd rt p wX wY -> m (Maybe (String, PatchInfoAnd rt p wX wY)) #
(Apply p, Conflict p, CommuteNoConflicts p, IsHunk p, PatchListFormat p, PrimPatchBase p, ShowPatch p, (~) ((* -> *) -> *) (ApplyState p) Tree) => ShowPatch (PatchInfoAnd rt p) # |
Methods showNicely :: PatchInfoAnd rt p wX wY -> Doc # showContextPatch :: (Monad m, ApplyMonad (ApplyState (PatchInfoAnd rt p)) m) => PatchInfoAnd rt p wX wY -> m Doc # description :: PatchInfoAnd rt p wX wY -> Doc # summary :: PatchInfoAnd rt p wX wY -> Doc # summaryFL :: FL (PatchInfoAnd rt p) wX wY -> Doc # thing :: PatchInfoAnd rt p wX wY -> String # things :: PatchInfoAnd rt p wX wY -> String #
(PatchListFormat p, ShowPatchBasic p) => ShowPatchBasic (PatchInfoAnd rt p) # |
Methods showPatch :: PatchInfoAnd rt p wX wY -> Doc #
IsHunk (PatchInfoAnd rt p) # |
Methods isHunk :: PatchInfoAnd rt p wX wY -> Maybe (FileHunk wX wY) #
(Patchy p, (~) ((* -> *) -> *) (ApplyState p) Tree) => Patchy (PatchInfoAnd rt p) # |
PrimPatchBase p => PrimPatchBase (PatchInfoAnd rt p) # |
Associated Types type PrimOf (PatchInfoAnd rt p :: * -> * -> *) :: * -> * -> * #
Effect p => Effect (PatchInfoAnd rt p) # |
Methods effect :: PatchInfoAnd rt p wX wY -> FL (PrimOf (PatchInfoAnd rt p)) wX wY # effectRL :: PatchInfoAnd rt p wX wY -> RL (PrimOf (PatchInfoAnd rt p)) wX wY #
Show2 p => Show1 (PatchInfoAnd rt p wX) # |
Methods showDict1 :: ShowDict (PatchInfoAnd rt p wX wX) #
Show2 p => Show (PatchInfoAnd rt p wA wB) # |
Methods showsPrec :: Int -> PatchInfoAnd rt p wA wB -> ShowS # show :: PatchInfoAnd rt p wA wB -> String # showList :: [PatchInfoAnd rt p wA wB] -> ShowS #
type ApplyState (PatchInfoAnd rt p) # |
type ApplyState (PatchInfoAnd rt p) = ApplyState p
type PrimOf (PatchInfoAnd rt p) # |
type PrimOf (PatchInfoAnd rt p) = PrimOf p

data WPatchInfo wA wB #

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

Instances

MyEq WPatchInfo # |
Methods unsafeCompare :: WPatchInfo wA wB -> WPatchInfo wC wD -> Bool # (=\/=) :: WPatchInfo wA wB -> WPatchInfo wA wC -> EqCheck wB wC # (=/\=) :: WPatchInfo wA wC -> WPatchInfo wB wC -> EqCheck wA wB #

unWPatchInfo :: WPatchInfo wA wB -> PatchInfo #

compareWPatchInfo :: WPatchInfo wA wB -> WPatchInfo wC wD -> EqCheck (wA, wB) (wC, wD) #

piap :: PatchInfo -> WrappedNamed rt p wA wB -> PatchInfoAnd rt p wA wB #

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

n2pia :: WrappedNamed rt p wX wY -> PatchInfoAnd rt p wX wY #

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

patchInfoAndPatch :: PatchInfo -> Hopefully (WrappedNamed rt p) wA wB -> PatchInfoAnd rt p wA wB #

fmapFLPIAP :: (FL p wX wY -> FL q wX wY) -> ((RebaseTypeOf rt :~~: IsRebase) -> p :~: q) -> PatchInfoAnd rt p wX wY -> PatchInfoAnd rt q wX wY #

generaliseRepoTypePIAP :: PatchInfoAnd (RepoType NoRebase) p wA wB -> PatchInfoAnd rt p wA wB #

conscientiously :: (Doc -> Doc) -> PatchInfoAnd rt p wA wB -> WrappedNamed rt p wA wB #

``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 rt p wA wB -> WrappedNamed rt p wA wB #

``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 rt p wA wB -> PatchInfo #

winfo :: PatchInfoAnd rt p wA wB -> WPatchInfo wA wB #

hopefullyM :: Monad m => PatchInfoAnd rt p wA wB -> m (WrappedNamed rt p wA wB) #

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

createHashed :: String -> (String -> IO (Sealed (a wX))) -> IO (Sealed (Hopefully a wX)) #

extractHash :: PatchInfoAnd rt p wA wB -> Either (WrappedNamed rt p wA wB) String #

actually :: a wX wY -> Hopefully a wX wY #

unavailable :: String -> Hopefully a wX wY #

patchDesc :: forall rt p wX wY. PatchInfoAnd rt p wX wY -> String #