
5 Jul
2006
5 Jul
'06
8:18 a.m.
Hello John, Wednesday, July 5, 2006, 3:04:22 PM, you wrote:
What I want to know is the generic way to force an entire String (or other list, perhaps from hGetContents) to be evaluated (read into RAM, I guess) so the underlying file can be closed.... and do it right now.
eval [] = [] eval (x:xs) = eval xs do str <- getContents return $! eval str .... is my usual hack. there is also `deepSeq` if you need to fully evaluate more complex structure. btw, this 'eval' don't evaluate list elements - it should be not a problem for evaluation result of 'getContents' -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com