<div dir="ltr">In Haskell, the value of a variable is not always evaluated.<div>This is fundamental when working with infinite lists.</div><div>Is there a way of determining whether, at a certain point of the execution of a program, a value has been calculated or not?</div><div><br></div><div>In particular, I would like to write a function that works on an infinite list that:</div><div>- if the first value of a list, x, has already been evaluated, returns [x]</div><div>- Else waits until it is evaluated, but without forcing its evaluation. (eventually, its evaluation will be forced later by other functions). Until then, the result of this function must be considered as [ ]. As soon as x is computed, it can return [x].</div><div><br></div><div>Is something like this possible in Haskell?</div></div>