writeFile -package:streaming

The computation writeFile file str function writes the string str, to the file file. This operation may fail with the same errors as hPutStr and withFile.

Examples

>>> writeFile "hello" "world" >> readFile "hello"
"world"
>>> writeFile "~/" "D:"
*** Exception: ~/: withFile: inappropriate type (Is a directory)
Write a ByteString to a file.
Write a Builder to a file. Similarly to hPutBuilder, this function is more efficient than using hPut . toLazyByteString with a file handle.
Write a string to a file. The file is truncated to zero length before writing begins.
The computation writeFile file str function writes the string str, to the file file.
Lifted version of writeFile.
Lifted writeFile
Lifted writeFile
Write lines to a file, automatically opening and closing the file as necessary
Replace the entire content of a binary file with the provided ByteString. This computation throws IOError on failure. See “Classifying I/O errors” in the System.IO.Error documentation for information on why the failure occured.
Write a Text to a file.
Write Chunks to a file, replacing the previous contents of the file.
Write a ByteString to a file.
Write a ByteStream to a file. Use runResourceT to ensure that the handle is closed.
>>> :set -XOverloadedStrings

>>> runResourceT $ Q.writeFile "hello.txt" "Hello world.\nGoodbye world.\n"

>>> :! cat "hello.txt"
Hello world.
Goodbye world.

>>> runResourceT $ Q.writeFile "hello2.txt" $ Q.readFile "hello.txt"

>>> :! cat hello2.txt
Hello world.
Goodbye world.
Write data to file.
Write Text to a file. The file is truncated to zero length before writing begins.
Write a YiString into the given file. It's up to the user to handle exceptions.
Write a Vector to a file.