Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data Splitter p = 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 :: (ShowPatch p, ReadPatch p, Invert p) => Splitter p
- noSplitter :: Splitter p
- primSplitter :: PrimPatch p => DiffAlgorithm -> Splitter p
- reversePrimSplitter :: PrimPatch prim => DiffAlgorithm -> Splitter prim
Documentation
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.
Splitter | |
|
rawSplitter :: (ShowPatch p, ReadPatch p, Invert p) => Splitter p Source #
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 Source #
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 => DiffAlgorithm -> Splitter p Source #
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 => DiffAlgorithm -> Splitter prim Source #