summaryrefslogtreecommitdiff
path: root/examples/Main.lhs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/Main.lhs')
-rw-r--r--examples/Main.lhs32
1 files changed, 32 insertions, 0 deletions
diff --git a/examples/Main.lhs b/examples/Main.lhs
new file mode 100644
index 00000000..7d798bfc
--- /dev/null
+++ b/examples/Main.lhs
@@ -0,0 +1,32 @@
1A very helpful and literate comment.
2% A very helpful comment for very helpful and very literate comment.
3\begin{code}
4module Main (main) where
5
6import Control.Monad
7import Network.BitTorrent
8import System.Environment
9import Control.Monad.Trans
10
11
12main :: IO ()
13main = do
14 [path] <- getArgs
15 torrent <- fromFile path
16
17 print (contentLayout "./" (tInfo torrent))
18
19 client <- newClient 2 []
20 swarm <- newLeecher client torrent
21
22 storage <- swarm `bindTo` "/tmp/"
23
24 ppStorage storage >>= print
25
26 discover swarm $ do
27 liftIO $ print "connected to peer"
28 forever $ do
29 liftIO (getCurrentProgress client >>= print)
30 exchange storage
31 liftIO $ print "disconnected"
32\end{code} \ No newline at end of file