From 604ab9ded08cf1f2f7ed0f3109d0cc11984f55ea Mon Sep 17 00:00:00 2001 From: Joe Crayne Date: Wed, 24 Oct 2018 18:15:24 -0400 Subject: Removed foreign imports of "static" functions. --- examples/testdiff.hs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 examples/testdiff.hs (limited to 'examples/testdiff.hs') diff --git a/examples/testdiff.hs b/examples/testdiff.hs new file mode 100644 index 0000000..4ed7dd4 --- /dev/null +++ b/examples/testdiff.hs @@ -0,0 +1,23 @@ +{-# LANGUAGE OverloadedStrings #-} + +import qualified Data.ByteString.Lazy as L +import Data.XDelta +import Text.XXD + +source :: L.ByteString +source = "It could be said that Joe was here. I don't know what to do about it." + +patched :: L.ByteString +patched = "It could be said that Joe, the magnificent, was here. I don't know what to do about it." + +delta :: XDeltaFailable XDelta +delta = computeDiff defaultConfig source patched + +main = do + mapM_ putStrLn $ xxd2 0 (L.toStrict source) + putStrLn "" + mapM_ putStrLn $ xxd2 0 (L.toStrict patched) + putStrLn "" + case delta of + XSuccess (XDelta d) -> mapM_ putStrLn $ xxd2 0 (L.toChunks d !! 0) + _ -> print delta -- cgit v1.2.3