[project @ 1996-01-08 20:28:12 by partain]
[ghc-hetmet.git] / ghc / misc / examples / io / io016 / Main.hs
1 import LibSystem (getArgs)
2
3 main   =  getArgs                           >>=        \ [f1,f2] ->
4           openFile f1 ReadMode              >>=        \ h1      ->
5           openFile f2 WriteMode             >>=        \ h2      ->
6           copyFile h1 h2                    >>
7           hClose h1                         >>
8           hClose h2
9
10 copyFile h1 h2 =
11           hIsEOF h1                         >>=        \ eof ->
12           if eof then
13             return ()
14           else
15             hGetChar h1                     >>=        \ c       ->
16             hPutChar h2 (toUpper c)         >>
17             copyFile h1 h2
18