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

Safe Haskell | None

Darcs.Patch.Split

Synopsis

- data Splitter p = Splitter {
  - 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 p
- noSplitter :: Splitter p
- primSplitter :: PrimPatch p => Splitter p
- reversePrimSplitter :: PrimPatch prim => Splitter prim

# Documentation

data Splitter p

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.

Constructors

Splitter |

Fields

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 p

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 p

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 p

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.

reversePrimSplitter :: PrimPatch prim => Splitter prim