diff options
author | Sam T <pxqr.sta@gmail.com> | 2013-07-07 02:54:35 +0400 |
---|---|---|
committer | Sam T <pxqr.sta@gmail.com> | 2013-07-07 02:54:35 +0400 |
commit | a572f188af8f7d05f37f9b85162759499c3965a8 (patch) | |
tree | 22c19f9b59586985e7802a41106dff9f6b07039a /examples/Main.lhs | |
parent | 0214143031eb11d2935dec29d2c88d7a011e5d9e (diff) |
~ Yet Another Literate Haskell Test.
Diffstat (limited to 'examples/Main.lhs')
-rw-r--r-- | examples/Main.lhs | 63 |
1 files changed, 30 insertions, 33 deletions
diff --git a/examples/Main.lhs b/examples/Main.lhs index 7af7a8a0..1a7b5b12 100644 --- a/examples/Main.lhs +++ b/examples/Main.lhs | |||
@@ -1,34 +1,31 @@ | |||
1 | A very helpful and literate comment. | 1 | A very helpful and literate comment. |
2 | % A very helpful comment for very helpful and very literate comment. | 2 | A very helpful comment for very helpful and very literate comment. |
3 | \begin{code} | 3 | |
4 | 4 | > module Main (main) where | |
5 | module Main (main) where | 5 | |
6 | 6 | > import Control.Monad | |
7 | import Control.Monad | 7 | > import Network.BitTorrent |
8 | import Network.BitTorrent | 8 | > import System.Environment |
9 | import System.Environment | 9 | > import Control.Monad.Trans |
10 | import Control.Monad.Trans | 10 | |
11 | 11 | ||
12 | 12 | > main :: IO () | |
13 | main :: IO () | 13 | > main = do |
14 | main = do | 14 | > [path] <- getArgs |
15 | [path] <- getArgs | 15 | > torrent <- fromFile path |
16 | torrent <- fromFile path | 16 | > |
17 | 17 | > print (contentLayout "./" (tInfo torrent)) | |
18 | print (contentLayout "./" (tInfo torrent)) | 18 | > |
19 | 19 | > client <- newClient 2 [] | |
20 | client <- newClient 2 [] | 20 | > swarm <- newLeecher client torrent |
21 | swarm <- newLeecher client torrent | 21 | > |
22 | 22 | > storage <- swarm `bindTo` "/tmp/" | |
23 | storage <- swarm `bindTo` "/tmp/" | 23 | > |
24 | 24 | > ppStorage storage >>= print | |
25 | ppStorage storage >>= print | 25 | > |
26 | 26 | > discover swarm $ do | |
27 | discover swarm $ do | 27 | > liftIO $ print "connected to peer" |
28 | liftIO $ print "connected to peer" | 28 | > forever $ do |
29 | forever $ do | 29 | > liftIO (getCurrentProgress client >>= print) |
30 | liftIO (getCurrentProgress client >>= print) | 30 | > exchange storage |
31 | exchange storage | 31 | > liftIO $ print "disconnected" |
32 | liftIO $ print "disconnected" | ||
33 | |||
34 | \end{code} \ No newline at end of file | ||