summaryrefslogtreecommitdiff
path: root/examples/testdiff.hs
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2018-10-24 18:15:24 -0400
committerJoe Crayne <joe@jerkface.net>2018-10-24 18:15:24 -0400
commit604ab9ded08cf1f2f7ed0f3109d0cc11984f55ea (patch)
tree859a712b66fe95ec906a8e3d42ba4c71982cbb11 /examples/testdiff.hs
parent32e5ed671ff84186c69a066ddab4d57ec3bd73d4 (diff)
Removed foreign imports of "static" functions.
Diffstat (limited to 'examples/testdiff.hs')
-rw-r--r--examples/testdiff.hs23
1 files changed, 23 insertions, 0 deletions
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 @@
1{-# LANGUAGE OverloadedStrings #-}
2
3import qualified Data.ByteString.Lazy as L
4import Data.XDelta
5import Text.XXD
6
7source :: L.ByteString
8source = "It could be said that Joe was here. I don't know what to do about it."
9
10patched :: L.ByteString
11patched = "It could be said that Joe, the magnificent, was here. I don't know what to do about it."
12
13delta :: XDeltaFailable XDelta
14delta = computeDiff defaultConfig source patched
15
16main = do
17 mapM_ putStrLn $ xxd2 0 (L.toStrict source)
18 putStrLn ""
19 mapM_ putStrLn $ xxd2 0 (L.toStrict patched)
20 putStrLn ""
21 case delta of
22 XSuccess (XDelta d) -> mapM_ putStrLn $ xxd2 0 (L.toChunks d !! 0)
23 _ -> print delta