
Hi, I want to do something like: | main = do | monstrousDataStructure <- monstrousComputation | hPutStr stderr "success!" | ... The important point is that I want to make sure that the computation has terminated and not failed before I go to `...'. I have tried | x <- x `seq` x and | x <- id $! x which should be equivalent anyway, but they both did not have any effect. Then, I remember that there was something called strict, but I can't find it any more. I am afraid I am missing something basic here. If you can't help me, I will come back with a more precise example, I just haven't found one so far (only the original code, but you don't want to read 1843 LOC on this list, do you?... :) thanks a lot, Matthias -- Matthias Fischmann | Research Engineer | +358 (9) 8565 7474 fis@ssh.fi | SSH Communication Security Corp | +358 (40) 752 5291

Hi,
I want to do something like:
| main = do | monstrousDataStructure <- monstrousComputation | hPutStr stderr "success!" | ...
The important point is that I want to make sure that the computation has terminated and not failed before I go to `...'. If the monstrous data structure has a 'serious' equality (not always returning True), you can try:
| main = do | monstrousDataStructure <- monstrousComputation | if (monstrousDataStructure == monstrousDataStructure) then | hPutStr stderr "success!" | else | hPutStr stderr "failure?" The idea is that comparing for equality walks over the entire data structure, forcing evaluation because every location has to be inspected. Hope this helps, Jan de Wit
participants (2)
-
fis@ssh.com
-
Jan de Wit