> From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Peter > Verswyvelen > > As a newbie I made a nice little program that called readFile > and writeFile on the same filename, but of course the file > handle of the readFile was not closed yet => access denied. A > nice case of getting bitten by my imperative background. > > So I guess hGet/hGetNonBlocking/ByteString is also the > correct way to solve this?
More than one person has posted previously about the flaws and traps of lazy IO. A common position seems to be "don't do lazy IO". http://article.gmane.org/gmane.comp.lang.haskell.cafe/20106/ Peter Simons has this library: http://cryp.to/blockio/ BTW, where's the tutorial that Peter wrote? http://article.gmane.org/gmane.comp.lang.haskell.cafe/4011/ And there are other IO libraries out there. Bulat has done a lot of work on stream IO, I recall. > PS: I would love to see an immutable filesystem that does not > allow writing to files, it only creates new files and garbage > collects files that have no incoming reference anymore... > Just like a garbage collected heap, and a bit like an OLAP > databases (as far as I remember my DB theory...) Besides the > performance bottleneck, does something like that exists? This might interest you: http://okmij.org/ftp/Computation/Continuations.html#zipper-fs Alistair ***************************************************************** Confidentiality Note: The information contained in this message, and any attachments, may contain confidential and/or privileged material. It is intended solely for the person(s) or entity to which it is addressed. Any review, retransmission, dissemination, or taking of any action in reliance upon this information by persons or entities other than the intended recipient(s) is prohibited. If you received this in error, please contact the sender and delete the material from any computer. ***************************************************************** _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe