Skip to content

Commit 331371e

Browse files
committed
added haskell append to file snippet
1 parent 819f66a commit 331371e

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: Append to File
3+
description: Appends text to an existing file.
4+
author: ACR1209
5+
tags: haskell,file,append,utilty
6+
---
7+
8+
```hs
9+
import System.IO
10+
11+
appendToFile :: FilePath -> String -> IO ()
12+
appendToFile = appendFile
13+
14+
main :: IO ()
15+
main = do
16+
let file = "example.txt"
17+
let text = "This will be appended to the file.\n"
18+
appendToFile file text
19+
```

0 commit comments

Comments
 (0)