module Darcs.Util.Diff
    ( getChanges
    , DiffAlgorithm(..)
    ) where

import Darcs.Prelude

import qualified Darcs.Util.Diff.Myers as M ( getChanges )
import qualified Darcs.Util.Diff.Patience as P ( getChanges )
import qualified Data.ByteString as B ( ByteString )


data DiffAlgorithm = PatienceDiff | MyersDiff
    deriving ( DiffAlgorithm -> DiffAlgorithm -> Bool
(DiffAlgorithm -> DiffAlgorithm -> Bool)
-> (DiffAlgorithm -> DiffAlgorithm -> Bool) -> Eq DiffAlgorithm
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DiffAlgorithm -> DiffAlgorithm -> Bool
== :: DiffAlgorithm -> DiffAlgorithm -> Bool
$c/= :: DiffAlgorithm -> DiffAlgorithm -> Bool
/= :: DiffAlgorithm -> DiffAlgorithm -> Bool
Eq, Int -> DiffAlgorithm -> ShowS
[DiffAlgorithm] -> ShowS
DiffAlgorithm -> String
(Int -> DiffAlgorithm -> ShowS)
-> (DiffAlgorithm -> String)
-> ([DiffAlgorithm] -> ShowS)
-> Show DiffAlgorithm
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DiffAlgorithm -> ShowS
showsPrec :: Int -> DiffAlgorithm -> ShowS
$cshow :: DiffAlgorithm -> String
show :: DiffAlgorithm -> String
$cshowList :: [DiffAlgorithm] -> ShowS
showList :: [DiffAlgorithm] -> ShowS
Show )

getChanges :: DiffAlgorithm -> [B.ByteString] -> [B.ByteString]
              -> [(Int,[B.ByteString],[B.ByteString])]
getChanges :: DiffAlgorithm
-> [ByteString]
-> [ByteString]
-> [(Int, [ByteString], [ByteString])]
getChanges DiffAlgorithm
dac = case DiffAlgorithm
dac of
                   DiffAlgorithm
PatienceDiff -> [ByteString] -> [ByteString] -> [(Int, [ByteString], [ByteString])]
P.getChanges
                   DiffAlgorithm
MyersDiff -> [ByteString] -> [ByteString] -> [(Int, [ByteString], [ByteString])]
M.getChanges