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

Safe Haskell | None
Language | Haskell2010

Darcs.Patch.Split

Synopsis

- data Splitter (p :: Type -> Type -> Type) = Splitter {
  - applySplitter :: forall wX wY. p wX wY -> Maybe (ByteString, ByteString -> Maybe (FL p wX wY))
  - canonizeSplit :: forall wX wY. FL p wX wY -> FL p wX wY
  }
- rawSplitter :: forall (p :: Type -> Type -> Type). (ShowPatch p, ReadPatch p, Invert p) => Splitter p
- noSplitter :: forall (p :: Type -> Type -> Type). Splitter p
- primSplitter :: forall (p :: Type -> Type -> Type). PrimPatch p => DiffAlgorithm -> Splitter p
- reversePrimSplitter :: forall (prim :: Type -> Type -> Type). PrimPatch prim => DiffAlgorithm -> Splitter prim

# Documentation

data Splitter (p :: Type -> Type -> Type) #

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 wX wY. p wX wY -> Maybe (ByteString, ByteString -> Maybe (FL p wX wY)) canonizeSplit :: forall wX wY. FL p wX wY -> FL p wX wY

rawSplitter :: forall (p :: Type -> Type -> Type). (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 :: forall (p :: Type -> Type -> Type). 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 :: forall (p :: Type -> Type -> Type). PrimPatch p => DiffAlgorithm -> 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 :: forall (prim :: Type -> Type -> Type). PrimPatch prim => DiffAlgorithm -> Splitter prim #