@@ -1,34 +0,0 @@
1−{-# LANGUAGE FlexibleContexts #-}
2−
3−import Control.Applicative ((<$>), (<*>), (<|>))
4−import Control.Monad.IO.Class (liftIO)
5−import System.IO
6−import Asyncly
7−import Control.Monad.Trans.Recorder (pause, record)
8−
9−main = do
10− hSetBuffering stdout LineBuffering
11− logs <- runAsynclyRecorded comp
12−
13− putStrLn $ "\nResuming with logs:"
14− logs1 <- runAsynclyRecorded $ playRecordings comp logs
15−
16− putStrLn $ "\nResuming with logs:"
17− logs2 <- runAsynclyRecorded $ playRecordings comp logs1
18−
19− putStrLn $ "\nLogs at the end must be empty:"
20− putStrLn $ show logs2
21−
22− where
23−
24− comp = record $ threads 5 $ do
25− r <- record $ each [1..3]
26− record $ liftIO $ print ("A",r)
27− record pause
28− record $ liftIO $ print ("B",r)
29− x <- record $ (,) <$> (event 1 <|> event 2) <*> (event 3 <|> event 4)
30− record pause
31− liftIO $ print ("C", r, x)
32−
33− -- event n = async $ liftIO $ (do putStrLn ("event" ++ show n); return n :: IO Int)
34− event n = liftIO $ (do putStrLn ("event" ++ show n); return n :: IO Int)