[add a flag to print statistics as we go
John Meacham <john@repetae.net>**20051021103900] hunk ./Stats.hs 1
-module Stats(Stats,new,tick,ticks,getTicks,Stats.print,clear,MonadStats(..),combine, printStat, Stat, mtick, mticks, runStatT, runStatIO, tickStat, StatT, theStats ) where
+module Stats(Stats,new,tick,setPrintStats,ticks,getTicks,Stats.print,clear,MonadStats(..),combine, printStat, Stat, mtick, mticks, runStatT, runStatIO, tickStat, StatT, theStats ) where
hunk ./Stats.hs 31
+{-# NOINLINE printStats #-}
+printStats :: IORef Bool
+printStats = unsafePerformIO $ newIORef False
hunk ./Stats.hs 35
+setPrintStats :: Bool -> IO ()
+setPrintStats b = writeIORef printStats b
hunk ./Stats.hs 124
-    mticks' n a = ticks theStats n a
+    mticks' 0 _ = return ()
+    mticks' n a = do
+        p <- readIORef printStats
+        when p (CharIO.putStrLn $ (show a ++ ": " ++ show n))
+        ticks theStats n a