gameServer/ClientIO.hs
changeset 2296 19f2f76dc346
parent 2126 cb249fa8e3da
child 2348 b39d826e1ccd
--- a/gameServer/ClientIO.hs	Wed Aug 05 05:37:17 2009 +0000
+++ b/gameServer/ClientIO.hs	Wed Aug 05 05:44:13 2009 +0000
@@ -1,7 +1,11 @@
-{-# LANGUAGE PatternSignatures #-}
+{-# LANGUAGE CPP, PatternSignatures #-}
 module ClientIO where
 
-import qualified Control.Exception
+#if defined(NEW_EXCEPTIONS)
+import qualified Control.OldException as Exception
+#else
+import qualified Control.Exception as Exception
+#endif
 import Control.Concurrent.Chan
 import Control.Monad
 import System.IO
@@ -29,15 +33,15 @@
 clientSendLoop :: Handle -> Chan CoreMessage -> Chan [String] -> Int -> IO()
 clientSendLoop handle coreChan chan clientID = do
 	answer <- readChan chan
-	doClose <- Control.Exception.handle
-		(\(e :: Control.Exception.Exception) -> if isQuit answer then return True else sendQuit e >> return False) $ do
+	doClose <- Exception.handle
+		(\(e :: Exception.Exception) -> if isQuit answer then return True else sendQuit e >> return False) $ do
 		forM_ answer (\str -> hPutStrLn handle str)
 		hPutStrLn handle ""
 		hFlush handle
 		return $ isQuit answer
 
 	if doClose then
-		Control.Exception.handle (\(_ :: Control.Exception.Exception) -> putStrLn "error on hClose") $ hClose handle
+		Exception.handle (\(_ :: Exception.Exception) -> putStrLn "error on hClose") $ hClose handle
 		else
 		clientSendLoop handle coreChan chan clientID