Safe Haskell | None |
---|---|
Language | Haskell2010 |
Darcs.Patch.Show
Synopsis
- class ShowPatchBasic (p :: Type -> Type -> Type) where
- showPatch :: ShowPatchFor -> p wX wY -> Doc
- displayPatch :: ShowPatchBasic p => p wX wY -> Doc
- data ShowPatchFor
- class ShowPatchBasic p => ShowPatch (p :: Type -> Type -> Type) where
- class ShowPatchBasic p => ShowContextPatch (p :: Type -> Type -> Type) where
- showPatchWithContextAndApply :: ApplyMonad (ApplyState p) m => ShowPatchFor -> p wX wY -> m Doc
- showPatchWithContext :: (ApplyMonadTrans (ApplyState p) m, ShowContextPatch p) => ShowPatchFor -> ApplyState p m -> p wX wY -> m Doc
- formatFileName :: FileNameFormat -> AnchoredPath -> Doc
Documentation
class ShowPatchBasic (p :: Type -> Type -> Type) where #
Methods
showPatch :: ShowPatchFor -> p wX wY -> Doc #
Instances
displayPatch :: ShowPatchBasic p => p wX wY -> Doc #
data ShowPatchFor #
Constructors
ForDisplay | |
ForStorage |
class ShowPatchBasic p => ShowPatch (p :: Type -> Type -> Type) where #
This class is used only for user interaction, not for storage. The default
implementations for description
and content
are suitable only for
PrimPatch
and RepoPatch
types. Logically, description
should default
to mempty
while content
should default to displayPatch
. We define them
the other way around so that showFriendly
gives
reasonable results for all patch types.
Minimal complete definition
Instances
class ShowPatchBasic p => ShowContextPatch (p :: Type -> Type -> Type) where #
Methods
showPatchWithContextAndApply :: ApplyMonad (ApplyState p) m => ShowPatchFor -> p wX wY -> m Doc #
Show a patch with context lines added, as diff -u does. Thus, it
differs from showPatch only for hunks. It is used for instance before
putting it into a bundle. As this unified context is not included in
patch representation, this requires access to the ApplyState
.
Note that this applies the patch in the ApplyMonad
given by the
context. This is done in order to simplify showing multiple patches in a
series, since each patch may change the context lines for later changes.
For a version that does not apply the patch see showPatchWithContext
.
Instances
showPatchWithContext :: (ApplyMonadTrans (ApplyState p) m, ShowContextPatch p) => ShowPatchFor -> ApplyState p m -> p wX wY -> m Doc #
Like showPatchWithContextAndApply
but without applying the patch
in the monad m
.
formatFileName :: FileNameFormat -> AnchoredPath -> Doc #
Format a AnchoredPath
to a Doc
according to the given FileNameFormat
.
NOTE: This is not only used for display but also to format patch files. This is
why we have to do the white space encoding here.
See writePatchIfNecessary
.
Besides white space encoding, for FileNameFormatV2
we just pack it into a Doc
. For
FileNameFormatV1
we must emulate the non-standard darcs-1 encoding of file paths: it
is an UTF8 encoding of the raw byte stream, interpreted as code points.
See also readFileName
.