blob: 36598e6d5b939e6b0c39b4ac89b0a2359673c7dd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
module Main where
import System.IO
import Control.Exception
import System.Directory
main = bracket
(openTempFile "." "test.txt")
(\(f,_) -> removeFile f)
(\(f,h) -> do hPutStrLn h $ "\xa9" -- Copyright symbol
hClose h
s <- readFile f
if (s /= "\xa9\n") then error ("failed: " ++ s) else return ())
|