Typo
[packages/base.git] / tests / IO / hDuplicateTo001.hs
1 import GHC.IO
2 import GHC.IO.Handle
3 import GHC.IO.Handle.Types
4 import System.IO
5 import Control.Concurrent.MVar
6 import Data.Typeable
7 import qualified GHC.IO.FD as FD
8
9 main = do
10 h <- openFile "tmp" WriteMode
11 hDuplicateTo h stdout
12
13 fdh <- getfd h
14 fdstdout <- getfd stdout
15 hPutStrLn stderr ("h: " ++ show (fdh /= fdstdout) ++ "\nstdout: " ++ show fdstdout)
16
17 hClose h
18 putStrLn "bla"
19
20
21 getfd h@(FileHandle _ mvar) = do
22 withMVar mvar $ \h__@Handle__{haDevice=dev} ->
23 case cast dev of
24 Just fd -> return (FD.fdFD fd)
25 Nothing -> error "getfd"