summaryrefslogtreecommitdiff
path: root/exsamples/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'exsamples/Main.hs')
-rw-r--r--exsamples/Main.hs14
1 files changed, 11 insertions, 3 deletions
diff --git a/exsamples/Main.hs b/exsamples/Main.hs
index 81958613..a5b865b0 100644
--- a/exsamples/Main.hs
+++ b/exsamples/Main.hs
@@ -1,3 +1,4 @@
1{-# LANGUAGE ViewPatterns #-}
1module Main (main) where 2module Main (main) where
2 3
3import Control.Concurrent 4import Control.Concurrent
@@ -18,8 +19,15 @@ main = do
18 discover swarm $ do 19 discover swarm $ do
19 addr <- asks connectedPeerAddr 20 addr <- asks connectedPeerAddr
20 liftIO $ print $ "connected to" ++ show addr 21 liftIO $ print $ "connected to" ++ show addr
21 e <- awaitEvent 22
22 liftIO $ print e 23 forever $ do
23 liftIO $ threadDelay (100 * 1000000) 24 e <- awaitEvent
25 case e of
26 Available bf
27 | Just m <- findMin bf -> yieldEvent (Want (BlockIx m 0 10))
28 | otherwise -> return ()
29 Want bix -> liftIO $ print bix
30 Fragment blk -> liftIO $ print (ppBlock blk)
31
24 32
25 print "Bye-bye! =_=" \ No newline at end of file 33 print "Bye-bye! =_=" \ No newline at end of file