writeFile package:base

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)