IO errors

Ian Lynagh
Wed, 28 Nov 2001 20:03:29 +0000

Hi guys,

Me again I'm afraid...

A quick look at the source looks like both GHC and NHC will simply pass
on errors from the OS, so for example with

    module Main where

    import IO
    import Directory

    main :: IO()
    main = do catch (createDirectory "this/does/not/exist/foo")
                    (\e -> putStrLn $ show $ map (flip ($) e) errors)

    errors :: [(IOError -> Bool)]
    errors = [isDoesNotExistError,

both GHC and NHC give [True,False,False,False] (I don't seem to have a
hugs Directory.hs) while the library report only allows
isIllegalOperation, isPermissionError and isAlreadyExistsError. I
haven't looked for other cases of this.

(this is under Linux, don't know if it would behave differently under
other OSes).