
5 Feb
2015
5 Feb
'15
3:26 p.m.
On Thu, Feb 05, 2015 at 02:51:52PM -0500, Geoffrey Bays wrote:
As I work my way through Learn You as Haskell, I have been writing small File IO programs. Unlike the example in that book, where the author reads from one file, writes altered data to a temp file and then deletes the original file and renames the temp file, I have been trying to read from a given file, alter the data and then overwrite the same file with the new data. Is this possible?
Try `withFile` [1], there is an example of its usage in chapter 9 of LYAH [2]. [1] https://downloads.haskell.org/~ghc/6.12.2/docs/html/libraries/base-4.2.0.1/S... [2] http://learnyouahaskell.com/input-and-output#files-and-streams