diff3-0.3.1: Perform a 3-way difference of documents

Safe HaskellSafe
LanguageHaskell98

Data.Algorithm.Diff3

Description

An implementation of a 3-way merge algorithm.

Synopsis

Documentation

data Hunk a Source #

A hunk is a collection of changes that occur in a document. A hunk can be some changes only in A, only in B, in both A & B (equally), or conflicting between A, B and the original document. All hunks take 3 constructors, which are, in order - the elements in the left document, the original document, and the right document. This order matches the order of parameters to diff3.

Constructors

LeftChange [a] 
RightChange [a] 
Unchanged [a] 
Conflict [a] [a] [a] 

Instances

Functor Hunk Source # 

Methods

fmap :: (a -> b) -> Hunk a -> Hunk b #

(<$) :: a -> Hunk b -> Hunk a #

Eq a => Eq (Hunk a) Source # 

Methods

(==) :: Hunk a -> Hunk a -> Bool #

(/=) :: Hunk a -> Hunk a -> Bool #

Show a => Show (Hunk a) Source # 

Methods

showsPrec :: Int -> Hunk a -> ShowS #

show :: Hunk a -> String #

showList :: [Hunk a] -> ShowS #

diff3 :: Eq a => [a] -> [a] -> [a] -> [Hunk a] Source #

Perform a 3-way diff against 2 documents and the original document. This returns a list of Hunks, where each Hunk contains the original document, a change in the left or right side, or is in conflict. This can be considered a 'low level' interface to the 3-way diff algorithm - you may be more interested in merge.

merge :: [Hunk a] -> Either [Hunk a] [a] Source #