strict 0.3.1 → 0.3.2
raw patch · 4 files changed
+2/−55 lines, 4 filesdep ~base
Dependency ranges changed: base
Files
- System/IO/Strict.hs +1/−1
- strict.cabal +1/−1
- tests/files.hs +0/−18
- tests/speed.hs +0/−35
System/IO/Strict.hs view
@@ -24,7 +24,7 @@ ) where -import Prelude ( String, (>>=), last, seq, return, (.), (=<<), FilePath)+import Prelude ( String, (>>=), seq, return, (.), (=<<), FilePath, length) import System.IO (IO) import qualified System.IO as IO
strict.cabal view
@@ -1,5 +1,5 @@ Name: strict-Version: 0.3.1+Version: 0.3.2 Synopsis: Strict data types and String IO. Category: Data, System Description:
− tests/files.hs
@@ -1,18 +0,0 @@-import qualified Prelude as Lazy (readFile)-import Prelude (putStrLn, putChar)-import System.IO.Strict-import Control.Monad--main = do- let n = [0..99999]- putStrLn "Strict IO"- mapM_ strict n- putChar '\n'-- putStrLn "Lazy IO"- mapM_ lazy n -- should fail- putChar '\n'-- where- strict i = do readFile "files.hs"; putChar '!'- lazy i = do Lazy.readFile "files.hs"; putChar '~'
− tests/speed.hs
@@ -1,35 +0,0 @@--import Text.Printf-import Control.Exception-import System.CPUTime--import qualified Data.ByteString as S--import Prelude hiding (readFile)-import qualified Prelude as Lazy (readFile)-import System.IO.Strict-import Control.Monad--time :: IO t -> IO t-time a = do- start <- getCPUTime- v <- a- v `seq` return ()- end <- getCPUTime- let diff = (fromIntegral (end - start)) / (10^12)- printf "Computation time: %0.3f sec\n" (diff :: Double)- return v--main = do- let n = [0..500]- putStrLn "Strict IO"- time $ mapM_ strict n- putChar '\n'-- putStrLn "Strict ByteString IO"- time $ mapM_ bytestring n- putChar '\n'-- where- strict i = do readFile "/usr/share/dict/words"; putChar '!'- bytestring i = do S.readFile "/usr/share/dict/words"; putChar '~'