diff options
author | Joe Crayne <joe@jerkface.net> | 2018-10-24 18:15:24 -0400 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2018-10-24 18:15:24 -0400 |
commit | 604ab9ded08cf1f2f7ed0f3109d0cc11984f55ea (patch) | |
tree | 859a712b66fe95ec906a8e3d42ba4c71982cbb11 /examples/testdiff.hs | |
parent | 32e5ed671ff84186c69a066ddab4d57ec3bd73d4 (diff) |
Removed foreign imports of "static" functions.
Diffstat (limited to 'examples/testdiff.hs')
-rw-r--r-- | examples/testdiff.hs | 23 |
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 | |||
3 | import qualified Data.ByteString.Lazy as L | ||
4 | import Data.XDelta | ||
5 | import Text.XXD | ||
6 | |||
7 | source :: L.ByteString | ||
8 | source = "It could be said that Joe was here. I don't know what to do about it." | ||
9 | |||
10 | patched :: L.ByteString | ||
11 | patched = "It could be said that Joe, the magnificent, was here. I don't know what to do about it." | ||
12 | |||
13 | delta :: XDeltaFailable XDelta | ||
14 | delta = computeDiff defaultConfig source patched | ||
15 | |||
16 | main = 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 | ||