4 import Directory (removeFile)
7 openFile "io008.in" ReadMode >>= \ hIn ->
8 openFile "io008.out" ReadWriteMode >>= \ hOut ->
9 removeFile "io008.out" >>
10 hGetPosn hIn >>= \ bof ->
14 hSeek hOut AbsoluteSeek 0 >>
15 hGetContents hOut >>= \ stuff ->
18 copy :: Handle -> Handle -> IO ()
20 tryIO (hGetChar hIn) >>=
21 either (\ err -> if isEOFError err then return () else error "copy") ( \ x -> hPutChar hOut x >> copy hIn hOut)