-- 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
--   <a>http://alfedenzo.livejournal.com/170301.html</a> and
--   <a>http://bramcohen.livejournal.com/73318.html</a>.
--   
--   New in version 0.1.1: relaxed <tt>containers</tt> dependency, so it
--   should build on GHC 6.10.
@package patience
@version 0.1.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 <a>diff</a>
Old :: t -> Item t

-- | Value taken from the "new" list, i.e. right argument to <a>diff</a>
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 <tt>'-'</tt> or <tt>'+'</tt> or <tt>' '</tt> for
--   <a>Old</a> or <a>New</a> or <a>Both</a> respectively.
itemChar :: Item t -> Char

-- | The value from an <a>Item</a>. For <a>Both</a>, 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
--   
--   <ul>
--   <li>it is monotonically increasing, and</li>
--   <li>it is at least as long as any other such subsequence.</li>
--   </ul>
--   
--   This function uses patience sort:
--   <a>http://en.wikipedia.org/wiki/Patience_sorting</a>. 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 Data.Data.Data t => Data.Data.Data (Data.Algorithm.Patience.Item t)
instance GHC.Read.Read t => GHC.Read.Read (Data.Algorithm.Patience.Item t)
instance GHC.Show.Show t => GHC.Show.Show (Data.Algorithm.Patience.Item t)
instance GHC.Classes.Ord t => GHC.Classes.Ord (Data.Algorithm.Patience.Item t)
instance GHC.Classes.Eq t => GHC.Classes.Eq (Data.Algorithm.Patience.Item t)
instance GHC.Show.Show a => GHC.Show.Show (Data.Algorithm.Patience.Piece a)
instance GHC.Base.Functor Data.Algorithm.Patience.Item
