summaryrefslogtreecommitdiff
path: root/ghc/misc/examples/io/io007/Main.hs
blob: 467382ff76c3467e4c7d40a008e1a66336c66466 (plain)
1
2
3
4
5
6
7
8
9
10
11
import IO -- 1.3

main =
    openFile "io007.in" ReadMode >>= \ hIn ->
    hPutStr hIn "test" `catch`
    \ err ->
        if isIllegalOperation err then
        hGetContents hIn >>= \ stuff ->
        hPutStr stdout stuff
	else
	    error "Oh dear\n"