From f7245e3cc7c5729b401bbbe3438a9f5b9dda211b Mon Sep 17 00:00:00 2001 From: Sam T Date: Mon, 8 Jul 2013 04:52:10 +0400 Subject: ~ Unliterate example. --- examples/Main.hs | 23 +++++++++++++++++++++++ examples/Main.lhs | 23 ----------------------- 2 files changed, 23 insertions(+), 23 deletions(-) create mode 100644 examples/Main.hs delete mode 100644 examples/Main.lhs (limited to 'examples') diff --git a/examples/Main.hs b/examples/Main.hs new file mode 100644 index 00000000..bc3fbb8b --- /dev/null +++ b/examples/Main.hs @@ -0,0 +1,23 @@ +module Main (main) where + +import Control.Monad +import Network.BitTorrent +import Network.BitTorrent.Extension +import System.Environment +import Control.Monad.Trans + +main :: IO () +main = do + [path] <- getArgs + torrent <- fromFile path + print (contentLayout "./" (tInfo torrent)) + client <- newClient 100 [ExtDHT] + swarm <- newLeecher client torrent + storage <- swarm `bindTo` "/tmp/" + ppStorage storage >>= print + discover swarm $ do + liftIO $ print "connected to peer" + forever $ do + liftIO (getCurrentProgress client >>= print) + exchange storage + liftIO $ print "disconnected" diff --git a/examples/Main.lhs b/examples/Main.lhs deleted file mode 100644 index 4d1c4eef..00000000 --- a/examples/Main.lhs +++ /dev/null @@ -1,23 +0,0 @@ -> module Main (main) where -> -> import Control.Monad -> import Network.BitTorrent -> import System.Environment -> import Control.Monad.Trans -> -> -> main :: IO () -> main = do -> [path] <- getArgs -> torrent <- fromFile path -> print (contentLayout "./" (tInfo torrent)) -> client <- newClient 2 [] -> swarm <- newLeecher client torrent -> storage <- swarm `bindTo` "/tmp/" -> ppStorage storage >>= print -> discover swarm $ do -> liftIO $ print "connected to peer" -> forever $ do -> liftIO (getCurrentProgress client >>= print) -> exchange storage -> liftIO $ print "disconnected" -- cgit v1.2.3