True, but using seq you can define deepSeq/rnf (depening on which camp you're from), which isn't misleading in this way. -- Hal Daume III "Computer science is no more about computers | hdaume@isi.edu than astronomy is about telescopes." -Dijkstra | www.isi.edu/~hdaume On Tue, 14 May 2002, Iavor S. Diatchki wrote:
hello,
this is misleading. seq only evaluates to whnf, i.e. the outermost lazy constructor (or lambda) and that only if the "seq ..." expression is actually evaluated, which is often tricky to ensure. furthermore, for non-functions one can get the same behaviour, by using a case with a pattern.
here is why i think the example does not illustrate what is seq good for:
main::IO() main=do time1 <- getCPUTime w <- return $! map undefined [1..] time2 <- getCPUTime ....
the above computation does not take very long.
bye iavor
Jorge Adriano wrote:
One may ask the question: what is seq useful for not in conjunction with unsafePerformIO, other than efficiency. That, I don't know the answer to.
Here is an example.
main::IO() main=do time1 <- getCPUTime w <- return $! calcSomething time2 <- getCPUTime
...
J.A.
_______________________________________________ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
-- ================================================== | Iavor S. Diatchki, Ph.D. student | | Department of Computer Science and Engineering | | School of OGI at OHSU | | http://www.cse.ogi.edu/~diatchki | ==================================================
_______________________________________________ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell