[project @ 1998-08-08 19:20:33 by sof]
[ghc-hetmet.git] / ghc / tests / io / should_run / io016.hs
1 import IO -- 1.3
2
3 import System (getArgs)
4 import Char   (toUpper)
5 import Directory (removeFile)
6
7 main   =  getArgs                           >>=        \ [f1,f2] ->
8           openFile f1 ReadMode              >>=        \ h1      ->
9           openFile f2 WriteMode             >>=        \ h2      ->
10           removeFile f2                     >>
11           copyFile h1 h2                    >>
12           hClose h1                         >>
13           hClose h2
14
15 copyFile h1 h2 =
16           hIsEOF h1                         >>=        \ eof ->
17           if eof then
18             return ()
19           else
20             hGetChar h1                     >>=        \ c       ->
21             hPutChar h2 (toUpper c)         >>
22             copyFile h1 h2
23