diff options
author | Joe Crayne <joe@jerkface.net> | 2018-10-26 02:28:05 -0400 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2018-10-26 02:28:05 -0400 |
commit | e6168c1d804f14846562a2842bc569bfdc921c58 (patch) | |
tree | 3406bae946e7304fdb5d528ad72b58c41c172bac /examples/testdiff.hs | |
parent | 72edf82d5acce1f361771d7d2c70e7ffbfe7f009 (diff) |
Move haskell example into haskell/ directory.
Diffstat (limited to 'examples/testdiff.hs')
-rw-r--r-- | examples/testdiff.hs | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/examples/testdiff.hs b/examples/testdiff.hs deleted file mode 100644 index 7e20dc5..0000000 --- a/examples/testdiff.hs +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | {-# LANGUAGE OverloadedStrings #-} | ||
2 | |||
3 | import qualified Data.ByteString.Lazy as L | ||
4 | import Data.VCDIFF | ||
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 :: Result VCDIFF | ||
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 | Result δ@(VCDIFF d) me -> do | ||
23 | -- mapM_ (mapM_ putStrLn . xxd2 0) (chunksOf 16 d) | ||
24 | mapM_ putStrLn $ xxd2 0 (L.toStrict d) | ||
25 | print me | ||
26 | putStrLn "" | ||
27 | let Result patched' pe = applyPatch defaultConfig source δ | ||
28 | mapM_ putStrLn $ xxd2 0 (L.toStrict patched') -- $ L.take 48 patched') | ||
29 | print pe | ||
30 | print ("source",source) | ||
31 | print ("patched",patched) | ||