
After a few efforts, i've understood my mistake. I now write : t1d <- gettime putStrLn ("Methode 1 : " ++ show t1d) let t1=last (listeprem 5000) putStrLn (" " ++ show t1) t1f <- gettime putStrLn (" " ++ show t1f) and that's ok. What i feel shocking is having io code mixed within calculation code. I think it's possible to force calculation of t1d, t1 and t1f before (or without) displaying their values (i just want t1f - t1d). But how to make it ? Thanks, Didier . legajid a écrit :
Hi, my following code should show time before executing listeprem, then time after execution.
import System.Time gettime :: IO ClockTime gettime = getClockTime
main=do 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?
Thanks, Didier
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners