diff options
author | Sam T <sta.cs.vsu@gmail.com> | 2013-03-31 15:46:21 +0400 |
---|---|---|
committer | Sam T <sta.cs.vsu@gmail.com> | 2013-03-31 15:46:21 +0400 |
commit | a6b54241f2a5c56ec9b5103f34688bd26e69f810 (patch) | |
tree | 05bcccdc5a109c74429432ab5ac9176ddb273512 /pp/pp.hs | |
parent | 71560ebe0f02e10e2f70aadae15176fc4571c381 (diff) |
add test sample program - pretty print of bencoded file
Diffstat (limited to 'pp/pp.hs')
-rw-r--r-- | pp/pp.hs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/pp/pp.hs b/pp/pp.hs new file mode 100644 index 0000000..0924b6b --- /dev/null +++ b/pp/pp.hs | |||
@@ -0,0 +1,14 @@ | |||
1 | module Main (main) where | ||
2 | |||
3 | import Data.BEncode | ||
4 | import qualified Data.ByteString as B | ||
5 | import System.IO | ||
6 | import System.Environment | ||
7 | |||
8 | main :: IO () | ||
9 | main = do | ||
10 | path : _ <- getArgs | ||
11 | content <- B.readFile path | ||
12 | case decode content of | ||
13 | Left e -> hPutStrLn stderr e | ||
14 | Right be -> printPretty be \ No newline at end of file | ||