We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent db68080 commit c92a041Copy full SHA for c92a041
snippets/haskell/file-handling/write-to-file.md
@@ -0,0 +1,19 @@
1
+---
2
+title: Write to File
3
+description: Writes text to a file, overwriting any existing content.
4
+author: ACR1209
5
+tags: haskell,file,write
6
7
+
8
+```hs
9
+import System.IO (writeFile)
10
11
+writeToFile :: FilePath -> String -> IO ()
12
+writeToFile = writeFile
13
14
+main :: IO ()
15
+main = do
16
+ let file = "example.txt"
17
+ let content = "This is new content."
18
+ writeToFile file content
19
+```
0 commit comments