blob: 652b792ed967661beb3c09904fbd8530507e59f6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
import System.IO
import GHC.IO.Handle
import GHC.IO.FD as FD
main = do
writeFile "T4808.test" "This is some test data"
(fd, _) <- FD.openFile "T4808.test" ReadWriteMode False
hdl <- mkDuplexHandle fd "T4808.test" Nothing nativeNewlineMode
hClose hdl
(fd2, _) <- FD.openFile "T4808.test" ReadWriteMode False
print (fdFD fd == fdFD fd2) -- should be True
hGetLine hdl >>= print -- should fail with an exception
|