summaryrefslogtreecommitdiff
path: root/examples/Main.lhs
diff options
context:
space:
mode:
authorSam T <pxqr.sta@gmail.com>2013-07-07 02:32:21 +0400
committerSam T <pxqr.sta@gmail.com>2013-07-07 02:32:21 +0400
commit35a6426fc2b317850670eb038800f0cd96e59aee (patch)
tree74dc420c615fe46e9ba1cb554da34d9a8724c2bd /examples/Main.lhs
parentab9137ae8ac88a7dc0d15593a9754704e4058a52 (diff)
~ Literate Haskell test.
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