Did you try "seq"?  
        x `seq` y
should evalute x to WHNF before returning y.  If x is a pair
you may need to say

        seqPair x `seq` y

where
        seqPair (a,b) = a `seq` b

in order to force the components.

Simon

| -----Original Message-----
| From: Michael Marte [mailto:[EMAIL PROTECTED]]
| Sent: 25 September 2000 19:16
| To: [EMAIL PROTECTED]
| Subject: How to force evaluation entirely?
| 
| 
| Hello,
| 
| I am trying to process a huge bunch of large XML files in order
| to extract some data. For each XML file, a small summary (6 integers)
| is created which is kept until writing a HTML page displaying the
| results.
| 
| The ghc-compiled program behaves as expected: It opens one 
| XML file after
| the other but does not read a lot. After some 50 files, it 
| bails out due
| to lack of heap storage.
| 
| To overcome the problem, I tried to force the program to 
| compute summaries
| immediately after reading the corresponding XML file. I tried 
| some eager
| application ($!), some irrefutable pattern, and some 
| strictness flags, but
| I did not succeed. It seems to me that as long as something 
| is not really
| used, the implementation cannot be forced to evaluate it completely. I
| resorted to printing the summary to /dev/null right after 
| reading the XML
| file. This works fine. Is there a more elegant solution?
| 
| Thank you.
| 
| Michael Marte
| 
| 
| 
| 
| 
| 

Reply via email to