Skip to content

Commit c92a041

Browse files
committed
add Haskell snippet to write text to a file
1 parent db68080 commit c92a041

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)