packages feed

stateWriter 0.2.3 → 0.2.4

raw patch · 2 files changed

+10/−4 lines, 2 files

Files

stateWriter.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                stateWriter-version:             0.2.3+version:             0.2.4 synopsis:            A faster variant of the RWS monad transformers. description:         This is a version of the RWS monad transformers that should be much faster than what's found in transformers. The writer in the strict version does not leak memory. license:             BSD3
tests/spaceleak.hs view
@@ -3,6 +3,7 @@  import qualified Control.Monad.Trans.RSS.Lazy as RSSL import qualified Control.Monad.Trans.RSS.Strict as RSSS+import System.Environment import Control.Monad.Writer  n :: Int@@ -11,6 +12,11 @@ main :: IO () main = do     print $ RSSS.runRSS (replicateM_ n $ tell $ Sum (1 :: Int)) () ()-    putStrLn "Strict version ok, the next test should explode the stack."-    print $ RSSL.runRSS (replicateM_ n $ tell $ Sum (1 :: Int)) () ()-    putStrLn "Lazy version should have exploded !"+    tryExplode <- fmap (not . null) getArgs+    if tryExplode+        then do+            putStrLn "Strict version ok, the next test should explode the stack."+            print $ RSSL.runRSS (replicateM_ n $ tell $ Sum (1 :: Int)) () ()+            putStrLn "Lazy version should have exploded !"+        else+            putStrLn "Do not try exploding the stack. Run the test program with any command line argument to test it"