It is, BTW, always preferable to use withFile over openFile, if you can.
This makes your code cleaner and also exception-safe.



Hi Ertugrul,

    I don't think I quite understand. How is withFile exception-safe? Under the covers it's using openFile. I was under the impression withFile was just a nice way to remove boilerplate file operation code.  Here's what I found on hoogle: "withFile name mode act opens a file using openFile and passes the resulting handle to the computation act. The handle will be closed on exit from withFile, whether by normal termination or by raising an exception."


Thanks,
Jimmy