diff options
author | Sam Truzjan <pxqr.sta@gmail.com> | 2014-02-08 07:31:23 +0400 |
---|---|---|
committer | Sam Truzjan <pxqr.sta@gmail.com> | 2014-02-08 07:31:23 +0400 |
commit | 240f025f6e631a7b3b14173472028ae5f225fc7b (patch) | |
tree | e6ae54cf9ee71e9526abb941a78bb8eb278f00a3 /examples | |
parent | c197ad8fde170d414bdd869df20f28a48ac475e6 (diff) |
Redesign core of client
Diffstat (limited to 'examples')
-rw-r--r-- | examples/Client.hs | 21 |
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 @@ | |||
1 | module Main (main) where | 1 | module Main (main) where |
2 | |||
3 | import Control.Concurrent | ||
4 | import Data.Default | ||
5 | import System.Environment | 2 | import System.Environment |
6 | import Text.PrettyPrint.Class | 3 | import System.Exit |
7 | 4 | import System.IO | |
8 | import Network.BitTorrent | 5 | import Network.BitTorrent |
9 | 6 | ||
7 | parseArgs :: IO FilePath | ||
8 | parseArgs = 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 | ||
11 | main :: IO () | 16 | main :: IO () |
12 | main = do | 17 | main = 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 () |