From 98d545d08350a363724b70e69b4311b465a771c9 Mon Sep 17 00:00:00 2001
From: Ramakrishnan Muthukrishnan <ram@rkrishnan.org>
Date: Wed, 4 Feb 2015 21:01:20 +0530
Subject: [PATCH] WIP: create MetaInfo structure from torrentfile

---
 src/Main.hs     | 9 ++++++++-
 src/Metainfo.hs | 1 +
 2 files changed, 9 insertions(+), 1 deletion(-)
 create mode 100644 src/Metainfo.hs

diff --git a/src/Main.hs b/src/Main.hs
index 7ab4712..6d4b3ce 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -3,10 +3,17 @@ module Main where
 import System.Environment (getArgs)
 import qualified Data.ByteString.Char8 as BC
 import qualified Bencode as Benc
+import qualified Metainfo as MInfo
+import Text.ParserCombinators.Parsec
+
+printError :: ParseError -> IO ()
+printError e = putStrLn "parse error"
 
 main :: IO ()
 main = do
   args <- getArgs
   torrentStr <- BC.readFile (head args)
-  let metadata = Benc.decode torrentStr
+  case (Benc.decode torrentStr) of
+   Right d -> MInfo.mkMetaInfo d
+   Left e -> printError e
   putStrLn "done"
diff --git a/src/Metainfo.hs b/src/Metainfo.hs
new file mode 100644
index 0000000..b8240c5
--- /dev/null
+++ b/src/Metainfo.hs
@@ -0,0 +1 @@
+module Metainfo where
-- 
2.45.2