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

Safe HaskellSafe-Infered




data Splitter p Source

A splitter is something that can take a patch and (possibly) render it as text in some format of its own choosing. This text can then be presented to the user for editing, and the result given to the splitter for parsing. If the parse succeeds, the result is a list of patches that could replace the original patch in any context. Typically this list will contain the changed version of the patch, along with fixup pieces to ensure that the overall effect of the list is the same as the original patch. The individual elements of the list can then be offered separately to the user, allowing them to accept some and reject others.

There's no immediate application for a splitter for anything other than Prim (you shouldn't go editing named patches, you'll break them!) However you might want to compose splitters for FilePatchType to make splitters for Prim etc, and the generality doesn't cost anything.




applySplitter :: forall x y. p x y -> Maybe (ByteString, ByteString -> Maybe (FL p x y))
canonizeSplit :: forall x y. FL p x y -> FL p x y

rawSplitter :: (ShowPatch p, ReadPatch p, Invert p) => Splitter pSource

This generic splitter just lets the user edit the printed representation of the patch Should not be used expect for testing and experimentation.

noSplitter :: Splitter pSource

Never splits. In other code we normally pass around Maybe Splitter instead of using this as the default, because it saves clients that don't care about splitting from having to import this module just to get noSplitter.

primSplitter :: PrimPatch p => Splitter pSource

Split a primitive hunk patch up by allowing the user to edit both the before and after lines, then insert fixup patches to clean up the mess.