[Haskell-beginners] File I/O: reading from, writing to,

Doug McIlroy doug at cs.dartmouth.edu
Thu Feb 5 23:14:55 UTC 2015


        same file in one function
> I strongly urge you to use the
proper way with temp file and renaming, even making it a function if you
need to repeat this several times

The "proper way" is fraught with pitfalls: potentially changes in
file ownership and permissions, loss of linkage when the file is
known by multiple names, and even total failure if you don't have


The proper way does have one safety advantage. The original file
is highly likely to survive should the writing of the new contents
stop prematurely for some external reason.

Doug


More information about the Beginners mailing list