[Haskell-cafe] Strictness in do block

Neil Mitchell ndmitchell at gmail.com
Wed Jul 5 07:08:16 EDT 2006


Hi,

> 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.
What I have done in the past is to take the length of the string, and
test the length in some way - although I guess you could call seq on
the length.

Of course, the length tests technically doesn't evaluate the character
positions (just the spine of the list), but it always works in
practice.

Thanks

Neil


More information about the Haskell-Cafe mailing list