+#elif defined(__NHC__)
+ioeGetErrorType :: IOError -> IOErrorType
+ioeGetLocation :: IOError -> String
+
+ioeGetErrorType e | isAlreadyExistsError e = AlreadyExists
+ | isDoesNotExistError e = NoSuchThing
+ | isAlreadyInUseError e = ResourceBusy
+ | isFullError e = ResourceExhausted
+ | isEOFError e = EOF
+ | isIllegalOperation e = IllegalOperation
+ | isPermissionError e = PermissionDenied
+ | isUserError e = UserError
+
+ioeGetLocation (NHC.IOError _ _ _ _) = "unknown location"
+ioeGetLocation (NHC.EOFError _ _ ) = "unknown location"
+ioeGetLocation (NHC.PatternError loc) = loc
+ioeGetLocation (NHC.UserError loc _) = loc
+
+ioeSetErrorType :: IOError -> IOErrorType -> IOError
+ioeSetErrorString :: IOError -> String -> IOError
+ioeSetLocation :: IOError -> String -> IOError
+ioeSetHandle :: IOError -> Handle -> IOError
+ioeSetFileName :: IOError -> FilePath -> IOError
+
+ioeSetErrorType e _ = e
+ioeSetErrorString (NHC.IOError _ f h e) s = NHC.IOError s f h e
+ioeSetErrorString (NHC.EOFError _ f) s = NHC.EOFError s f
+ioeSetErrorString e@(NHC.PatternError _) _ = e
+ioeSetErrorString (NHC.UserError l _) s = NHC.UserError l s
+ioeSetLocation e@(NHC.IOError _ _ _ _) _ = e
+ioeSetLocation e@(NHC.EOFError _ _) _ = e
+ioeSetLocation (NHC.PatternError _) l = NHC.PatternError l
+ioeSetLocation (NHC.UserError _ m) l = NHC.UserError l m
+ioeSetHandle (NHC.IOError o f _ e) h = NHC.IOError o f (Just h) e
+ioeSetHandle (NHC.EOFError o _) h = NHC.EOFError o h
+ioeSetHandle e@(NHC.PatternError _) _ = e
+ioeSetHandle e@(NHC.UserError _ _) _ = e
+ioeSetFileName (NHC.IOError o _ h e) f = NHC.IOError o (Just f) h e
+ioeSetFileName e _ = e
+#endif
+