@@ -1,34 +0,0 @@
1−{-# LANGUAGE FlexibleContexts #-}
3−import Control.Applicative ((<$>), (<*>), (<|>))
4−import Control.Monad.IO.Class (liftIO)
7−import Control.Monad.Trans.Recorder (pause, record)
10− hSetBuffering stdout LineBuffering
11− logs <- runAsynclyRecorded comp
13− putStrLn $ "\nResuming with logs:"
14− logs1 <- runAsynclyRecorded $ playRecordings comp logs
16− putStrLn $ "\nResuming with logs:"
17− logs2 <- runAsynclyRecorded $ playRecordings comp logs1
19− putStrLn $ "\nLogs at the end must be empty:"
20− putStrLn $ show logs2
24− comp = record $ threads 5 $ do
25− r <- record $ each [1..3]
26− record $ liftIO $ print ("A",r)
28− record $ liftIO $ print ("B",r)
29− x <- record $ (,) <$> (event 1 <|> event 2) <*> (event 3 <|> event 4)
31− liftIO $ print ("C", r, x)
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)