+#ifdef __NHC__
+import System.IO.Error (catch, ioError)
+import IO (bracket)
+import DIOError -- defn of IOError type
+
+-- minimum needed for nhc98 to pretend it has Exceptions
+type Exception = IOError
+type IOException = IOError
+data ArithException
+data ArrayException
+data AsyncException
+
+throwIO :: Exception -> IO a
+throwIO = ioError
+throw :: Exception -> a
+throw = unsafePerformIO . throwIO
+
+evaluate :: a -> IO a
+evaluate x = x `seq` return x
+
+ioErrors :: Exception -> Maybe IOError
+ioErrors e = Just e
+arithExceptions :: Exception -> Maybe ArithException
+arithExceptions = const Nothing
+errorCalls :: Exception -> Maybe String
+errorCalls = const Nothing
+dynExceptions :: Exception -> Maybe Dynamic
+dynExceptions = const Nothing
+assertions :: Exception -> Maybe String
+assertions = const Nothing
+asyncExceptions :: Exception -> Maybe AsyncException
+asyncExceptions = const Nothing
+userErrors :: Exception -> Maybe String
+userErrors (UserError _ s) = Just s
+userErrors _ = Nothing
+
+block :: IO a -> IO a
+block = id
+unblock :: IO a -> IO a
+unblock = id
+
+assert :: Bool -> a -> a
+assert True x = x
+assert False _ = throw (UserError "" "Assertion failed")
+#endif
+