timeit 0.9.0.0 → 1.0.0.0
raw patch · 2 files changed
+12/−4 lines, 2 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
+ System.TimeIt: timeItT :: IO a -> IO (Double, a)
Files
- System/TimeIt.hs +10/−3
- timeit.cabal +2/−1
System/TimeIt.hs view
@@ -1,13 +1,20 @@-module System.TimeIt(timeIt) where+module System.TimeIt(timeIt, timeItT) where import System.CPUTime import Text.Printf +-- |Wrap an 'IO' computation so that it prints out the execution time. timeIt :: IO a -> IO a timeIt ioa = do+ (t, a) <- timeItT ioa+ printf "CPU time: %6.2fs\n" t+ return a++-- |Wrap an 'IO' computation so that it returns execution time is seconds as well as the real value.+timeItT :: IO a -> IO (Double, a)+timeItT ioa = do t1 <- getCPUTime a <- ioa t2 <- getCPUTime let t :: Double t = fromIntegral (t2-t1) * 1e-12- printf "CPU time: %6.2fs\n" t- return a+ return (t, a)
timeit.cabal view
@@ -1,5 +1,5 @@ Name: timeit-Version: 0.9.0.0+Version: 1.0.0.0 License: BSD3 Author: Lennart Augustsson Maintainer: Lennart Augustsson@@ -9,3 +9,4 @@ Build-type: Simple Build-Depends: base Exposed-modules: System.TimeIt+build-depends: base >= 3 && < 5