blob: 97ca344bb4b4a7dae981f5000a03897ef28e1758 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
import System.IO
import GHC.IO.Handle
import GHC.IO.FD as FD
main = do
(fd, _) <- FD.openFile "4808.hs" ReadWriteMode False
hdl <- mkDuplexHandle fd "4808.hs" Nothing nativeNewlineMode
hClose hdl
(fd2, _) <- FD.openFile "4808.hs" ReadWriteMode False
print (fdFD fd == fdFD fd2) -- should be True
hGetLine hdl >>= print -- should fail with an exception
|