
26 Oct
2000
26 Oct
'00
11:37 a.m.
contents <- hGetContents handle seq (last contents) (hClose handle)
vs.
contents <- hGetContents handle hClose handle
However I looked at the manual and it seems that hClose should force the whole of contents to be read anyway.
If some manual says this, it is wrong. The Haskell Report says that 'hGetContents' gives the handle a special status, called "semi-closed". A semi-closed handle becomes fully closed when 'hClose' is applied to it. When this occurs, the contents of the associated stream of characters (i.e. those returned by 'hGetContents') is truncated, and is the list of characters that have already been read from that handle. Regards, Malcolm