summaryrefslogtreecommitdiff
path: root/examples/pp.hs
blob: 7163754ea6b1985c069fe2e144d40129eb8e8684 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
module Main (main) where

import Data.BEncode
import qualified Data.ByteString as B
import System.IO
import System.Environment

main :: IO ()
main = do
  path : _ <- getArgs
  content  <- B.readFile path
  case decode content of
    Left  e  -> hPutStrLn stderr e
    Right be -> print $ ppBEncode be