-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Patience diff and longest increasing subsequence -- -- This library implements the "patience diff" algorithm, as well as the -- patience algorithm for the longest increasing subsequence problem. -- -- Patience diff computes the difference between two lists, for example -- the lines of two versions of a source file. It provides a good balance -- of performance, nice output for humans, and implementation simplicity. -- For more information, see -- http://alfedenzo.livejournal.com/170301.html and -- http://bramcohen.livejournal.com/73318.html. @package patience @version 0.1 -- | Implements "patience diff" and the patience algorithm for the longest -- increasing subsequence problem. module Data.Algorithm.Patience -- | The difference between two lists, according to the "patience diff" -- algorithm. diff :: Ord t => [t] -> [t] -> [Item t] -- | An element of a computed difference. data Item t -- | Value taken from the "old" list, i.e. left argument to diff Old :: t -> Item t -- | Value taken from the "new" list, i.e. right argument to diff New :: t -> Item t -- | Value taken from both lists. Both values are provided, in case your -- type has a non-structural definition of equality. Both :: t -> t -> Item t -- | The character '-' or '+' or ' ' for -- Old or New or Both respectively. itemChar :: Item t -> Char -- | The value from an Item. For Both, returns the "old" -- value. itemValue :: Item t -> t -- | Given: a list of distinct integers. Picks a subset of the integers in -- the same order, i.e. a subsequence, with the property that -- -- -- -- This function uses patience sort: -- http://en.wikipedia.org/wiki/Patience_sorting. For -- implementation reasons, the actual list returned is the reverse of the -- subsequence. -- -- You can pair each integer with an arbitrary annotation, which will be -- carried through the algorithm. longestIncreasing :: [(Int, a)] -> [(Int, a)] instance Typeable1 Item instance Show a => Show (Piece a) instance Eq t => Eq (Item t) instance Ord t => Ord (Item t) instance Show t => Show (Item t) instance Read t => Read (Item t) instance Data t => Data (Item t) instance Functor Item