summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorSam Truzjan <pxqr.sta@gmail.com>2014-02-08 07:31:23 +0400
committerSam Truzjan <pxqr.sta@gmail.com>2014-02-08 07:31:23 +0400
commit240f025f6e631a7b3b14173472028ae5f225fc7b (patch)
treee6ae54cf9ee71e9526abb941a78bb8eb278f00a3 /examples
parentc197ad8fde170d414bdd869df20f28a48ac475e6 (diff)
Redesign core of client
Diffstat (limited to 'examples')
-rw-r--r--examples/Client.hs21
1 files changed, 13 insertions, 8 deletions
diff --git a/examples/Client.hs b/examples/Client.hs
index 8d676145..2fc66101 100644
--- a/examples/Client.hs
+++ b/examples/Client.hs
@@ -1,17 +1,22 @@
1module Main (main) where 1module Main (main) where
2
3import Control.Concurrent
4import Data.Default
5import System.Environment 2import System.Environment
6import Text.PrettyPrint.Class 3import System.Exit
7 4import System.IO
8import Network.BitTorrent 5import Network.BitTorrent
9 6
7parseArgs :: IO FilePath
8parseArgs = do
9 args <- getArgs
10 case args of
11 [path] -> return path
12 _ -> do
13 hPutStrLn stderr "Usage: client file.torrent"
14 exitFailure
10 15
11main :: IO () 16main :: IO ()
12main = do 17main = do
13 [path] <- getArgs 18 path <- parseArgs
14 torrent <- fromFile path 19 torrent <- fromFile path
15 let logger = \ _ _ _ _ -> return () 20 simpleClient $ do
16 withClient def logger $ flip runBitTorrent $ do 21 h <- openTorrent torrent
17 return () 22 return ()