{-# LANGUAGE OverloadedStrings #-} import qualified Data.ByteString.Lazy as L import Data.VCDIFF import Text.XXD source :: L.ByteString source = "It could be said that Joe was here. I don't know what to do about it." target :: L.ByteString target = "It could be said that Joe, the magnificent, was here. I don't know what to do about it." source2 :: L.ByteString source2 = "It could be said that Joe was absolutely here. I don't know what to do about it." delta :: Result VCDIFF delta = computeDiff defaultConfig { flags = XD3_ADLER32 } source target delta2 :: Result VCDIFF delta2 = computeDiff defaultConfig { flags = XD3_ADLER32 } source target main = do putStrLn "source" mapM_ putStrLn $ xxd2 0 (L.toStrict source) putStrLn "" putStrLn "target" mapM_ putStrLn $ xxd2 0 (L.toStrict target) putStrLn "" case delta of Result δ me -> do let d = encodeVCDIFF δ putStrLn "diff(default)" mapM_ putStrLn $ xxd2 0 (L.toStrict d) print me {- putStrLn "" putStrLn "patched(default)" let Result patched pe = applyPatch defaultConfig source2 δ mapM_ putStrLn $ xxd2 0 (L.toStrict patched) -- $ L.take 48 target') print pe -} return () putStrLn $ "source = " ++ show source putStrLn $ "target = " ++ show target putStrLn "" case delta2 of Result δ me -> do let d = encodeVCDIFF δ putStrLn "diff(XD3_ADLER32)" mapM_ putStrLn $ xxd2 0 (L.toStrict d) print me putStrLn "" let Result patched pe = applyPatch defaultConfig source2 δ putStrLn "patched(XD3_ADLER32)" mapM_ putStrLn $ xxd2 0 (L.toStrict patched) -- $ L.take 48 target') print pe