Re: [Haskell-cafe] Mixing IO and STM

2005-12-29 Thread Jared Updike
Also, if you are trying to display a line that looks like insert 5 or consume 6 then consider using putStrLn (insert ++ show r) putStrLn (consume ++ show r) instead of print (insert ++ show r) print

Re: [Haskell-cafe] Mixing IO and STM

2005-12-29 Thread Brian Sniffen
Here's a version that provides clean output with no delays. It uses a single-entry mailbox (the TMVar output) to ensure the processing doesn't run too far ahead of the log. module Test where import System.Random import Control.Concurrent import Control.Concurrent.STM test :: IO () test = do