summaryrefslogtreecommitdiff
path: root/libraries/base/tests/IO/ioeGetErrorString001.hs
blob: 538062ea9a50689fb861a8b6283a7a2ec369c44f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
-- !!! test ioeGetErrorString

import System.IO
import System.IO.Error
import Data.Maybe

main = do
  h <- openFile "ioeGetErrorString001.hs" ReadMode
  hSeek h SeekFromEnd 0
  (hGetChar h >> return ()) `catchIOError`
        \e -> if isEOFError e
                then print (ioeGetErrorString e)
                else putStrLn "failed."