appendFile -package:storablevector

The computation appendFile file str function appends the string str, to the file file. Note that writeFile and appendFile write a literal string to a file. To write a value of any printable type, as with print, use the show function to convert the value to a string first. This operation may fail with the same errors as hPutStr and withFile.

Examples

The following example could be more efficently written by acquiring a handle instead with openFile and using the computations capable of writing to handles such as hPutStr.
>>> let fn = "hello_world"

>>> in writeFile fn "hello" >> appendFile fn " world!" >> (readFile fn >>= putStrLn)
"hello world!"
>>> let fn = "foo"; output = readFile' fn >>= putStrLn

>>> in output >> appendFile fn (show [1,2,3]) >> output
this is what's in the file
this is what's in the file[1,2,3]
Append a ByteString to a file.
Write a string to the end of a file.
The computation appendFile file str function appends the string str, to the file file. Note that writeFile and appendFile write a literal string to a file. To write a value of any printable type, as with print, use the show function to convert the value to a string first.
main = appendFile "squares" (show [(x,x*x) | x <- [0,0.1..2]])
Lifted version of appendFile.
Lifted appendFile
Lifted appendFile
Append a ByteString to a file. If the file does not exist, it will be created. This computation throws IOError on failure. See “Classifying I/O errors” in the System.IO.Error documentation for information on why the failure occured.
Append a Text to a file.
Append a ByteStream to a file. Use runResourceT to ensure that the handle is closed.
>>> runResourceT $ Q.writeFile "hello.txt" "Hello world.\nGoodbye world.\n"

>>> runResourceT $ Q.stdout $ Q.readFile "hello.txt"
Hello world.
Goodbye world.

>>> runResourceT $ Q.appendFile "hello.txt" "sincerely yours,\nArthur\n"

>>> runResourceT $ Q.stdout $  Q.readFile "hello.txt"
Hello world.
Goodbye world.
sincerely yours,
Arthur
Append data to file.
Write Text to the end of a file.
Lifted version of appendFile.
The computation appendFile file str function appends the lazy ByteString str, to the file file.
Like appendFile, but takes a PlatformPath instead of an OsPath.
Write a string to the end of a file The default definition uses withFile to open the file.
Append a ByteString to a file at the RawFilePath.
A prompt for appending a single line of text to a file. Useful for keeping a file of notes, things to remember for later, and so on--- using a keybinding, you can write things down just about as quickly as you think of them, so it doesn't have to interrupt whatever else you're doing. Who knows, it might be useful for other purposes as well!
Lifted version of appendFile.