-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | O(ND) diff algorithm in haskell.
--
-- Basic implementation of the standard diff algorithm.
@package Diff
@version 0.3.0
-- | This is an implementation of the O(ND) diff algorithm as described in
-- "An O(ND) Difference Algorithm and Its Variations (1986)"
-- http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927.
-- It is O(mn) in space. The algorithm is the same one used by standared
-- Unix diff.
module Data.Algorithm.Diff
-- | A value is either from the First list, the Second or
-- from Both. Both contains both the left and right values,
-- in case you are using a form of equality that doesn't check all data
-- (for example, if you are using a newtype to only perform equality on
-- side of a tuple).
data Diff a
First :: a -> Diff a
Second :: a -> Diff a
Both :: a -> a -> Diff a
-- | Takes two lists and returns a list of differences between them. This
-- is getDiffBy with == used as predicate.
getDiff :: Eq t => [t] -> [t] -> [Diff t]
-- | A form of getDiff with no Eq constraint. Instead, an
-- equality predicate is taken as the first argument.
getDiffBy :: (t -> t -> Bool) -> [t] -> [t] -> [Diff t]
-- | Takes two lists and returns a list of differences between them,
-- grouped into chunks. This is getGroupedDiffBy with ==
-- used as predicate.
getGroupedDiff :: Eq t => [t] -> [t] -> [Diff [t]]
getGroupedDiffBy :: (t -> t -> Bool) -> [t] -> [t] -> [Diff [t]]
instance Show DI
instance Eq DI
instance Show a => Show (Diff a)
instance Eq a => Eq (Diff a)
instance Show DL
instance Eq DL
instance Ord DL
-- | Author : Stephan Wehr (wehrfactisresearch.com) and JP Moresmau
-- (jpmoresmau.fr)
--
-- Generates a string output that is similar to diff normal mode
module Data.Algorithm.DiffOutput
-- | pretty print the differences. The output is similar to the output of
-- the diff utility
ppDiff :: [Diff [String]] -> String
-- | pretty print of diff operations
prettyDiffs :: [DiffOperation LineRange] -> Doc
type LineNo = Int
data LineRange
LineRange :: (LineNo, LineNo) -> [String] -> LineRange
lrNumbers :: LineRange -> (LineNo, LineNo)
lrContents :: LineRange -> [String]
data DiffOperation a
Deletion :: a -> LineNo -> DiffOperation a
Addition :: a -> LineNo -> DiffOperation a
Change :: a -> a -> DiffOperation a
instance Show LineRange
instance Show a => Show (DiffOperation a)