[Haskell-beginners] Time interval calculation

legajid legajid at free.fr
Sat Mar 13 15:20:58 EST 2010

my following code should show time before executing listeprem, then time 
after execution.

import System.Time
gettime :: IO ClockTime
gettime = getClockTime

    t1d <- gettime
    let t1=last (listeprem 5000)
    t1f <- gettime
    putStrLn ("Methode 1 : " ++ show t1d)
    putStrLn ("            " ++ show t1)
    putStrLn ("            " ++ show t1f)

Looking at the screen, t1d is displayed then, after a few seconds, t1 
and t1f.
But, t1d and t1f are equal.
It seems like if t1d and t1f where calculated at start of procedure, 
before we need calculating t1 for putStrLn.
How can i have t1f evaluated after t1, so i can calculate time elapsed 
for calculation of t1?


More information about the Beginners mailing list