mf-hcafe-15c311...@etc-network.de wrote: > On Sat, Oct 10, 2009 at 11:11:24PM +0200, Daniel Fischer wrote: >> No, readFile reads the file lazily. > > hm? oh, you are right, now that i fixed all the other problems in my > code readFile isn't a problem any more either... (-: > > (but then how does it know when to close the handle? gotta go read > the code i guess.)
It is somewhat documented, see http://www.haskell.org/ghc/docs/latest/html/libraries/base/System-IO.html or http://www.haskell.org/onlinelibrary/io.html, section 21.2.2 Semi-Closed Handles: "[...] A semi-closed handle becomes closed: * if hClose is applied to it; * if an I/O error occurs when reading an item from the handle; * or once the entire contents of the handle has been read." It is not stated here that the file /immediately/ gets closed after the last byte has been read. Does that mean implementations are free to postpone closing (e.g. until the next GC cycle)? Cheers Ben _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe