
tjay.dreaming:
On 2/5/07, ajb@spamcop.net
wrote: Quoting TJ
: I would think that with 100% laziness, nothing would happen until the Haskell program needed to output data to, e.g. the console. Quite obviously that's not it. So how is laziness defined in Haskell?
It means that the program behaves as if "things" are evaluated if and only if they are needed. "Needed" in the Haskell sense, means "needed to do I/O".
So it's just IO which makes things run huh? OK that's basically what I said there. Cool.
Exactly, no IO, no computation required: $ cat A.hs main = do let v = last [1..] -- could be very slow... return () $ time ./a.out ./a.out 0.00s user 0.00s system 0% cpu 0.003 total :) Laziness: you know it makes sense. -- Don