
At Sat, 4 Dec 2004 22:18:38 +0100, Frédéric Gobry wrote:
Since Haskell is lazy it won't evaluate the (+) so in it keeps all copies of the Stat until the very end when you actually print it. The ! annotation in the record definition doesn't allow Haskell to store closures in the members, so it is forced to evaluate it.
Wouldn't it be conceivable to reduce some expressions when the runtime system notices it starts to grow too much (some sort of expression garbage collection), or would this alter the semantic of the code too deeply ?
This paper may have some answers, though I don't if it addresses that specific question: Optimistic Evaluation: An adaptive evaluation strategy for non-strict programs available at (among other places): http://www.cl.cam.ac.uk/~rje33/icfp2003.pdf Jeremy Shaw. -- This message contains information which may be confidential and privileged. Unless you are the addressee (or authorized to receive for the addressee), you may not use, copy or disclose to anyone the message or any information contained in the message. If you have received the message in error, please advise the sender and delete the message. Thank you.