Permalink
Browse files

Fixed GHC 7.2 compatibility. Addressed several deprecation warnings.

  • Loading branch information...
1 parent b149dfe commit 97613c88354e47a8ad6bb5120f4b5f5c345569d4 Anthony Cowley committed Aug 31, 2011
Showing with 13 additions and 7 deletions.
  1. +1 −1 Ros/Core/RosBinary.hs
  2. +4 −2 Ros/RosTcp.hs
  3. +7 −3 Ros/RunNode.hs
  4. +1 −1 Ros/TopicUtil.hs
View
@@ -1,4 +1,4 @@
-{-# LANGUAGE ScopedTypeVariables, TypeSynonymInstances #-}
+{-# LANGUAGE ScopedTypeVariables, TypeSynonymInstances, FlexibleInstances #-}
-- |Binary serialization deserialization utilities for types used in
-- ROS messages. This module is used by generated code for .msg
-- types.
View
@@ -1,10 +1,12 @@
{-# LANGUAGE ScopedTypeVariables, BangPatterns #-}
module Ros.RosTcp (subStream, runServer) where
+import Prelude hiding (catch)
import Control.Applicative ((<$>))
import Control.Arrow (first)
import Control.Concurrent (forkIO, killThread, newEmptyMVar, takeMVar, putMVar)
import Control.Concurrent.STM (atomically)
import Control.Concurrent.STM.TVar
+import Control.Exception (catch, SomeException)
import Control.Monad.Reader
import Data.Binary.Put (runPut, putWord32le)
import Data.Binary.Get (runGet, getWord32le)
@@ -88,11 +90,11 @@ acceptClients sock clients negotiate mkBuffer = forever acceptClient
do debug "Closing client socket"
liftIO $
shutdown client ShutdownBoth `catch`
- \_ -> return ()
+ \(_::SomeException) -> return ()
r <- ask
t <- liftIO . forkIO $
serviceClient chan client `catch`
- \_ -> runReaderT cleanup1 r
+ \(_::SomeException) -> runReaderT cleanup1 r
let cleanup2 = cleanup1 >>
(liftIO $ killThread t)
liftIO . atomically $
View
@@ -1,6 +1,8 @@
module Ros.RunNode (runNode) where
+import Prelude hiding (catch)
import Control.Concurrent (readMVar,forkIO, killThread)
import Control.Concurrent.QSem (newQSem, signalQSem, waitQSem)
+import Control.Exception (catch, SomeException)
import Control.Monad.IO.Class
import System.Posix.Signals (installHandler, Handler(..), sigINT)
import Ros.Core.RosTypes
@@ -48,11 +50,13 @@ runNode name s = do (wait, _port) <- liftIO $ runSlave s
registerNode name s
debug "Spinning"
allDone <- liftIO $ newQSem 0
- let shutdown = do putStrLn "Shutting down"
- cleanupNode s `catch` \_ -> return ()
+ let ignoreEx :: SomeException -> IO ()
+ ignoreEx _ = return ()
+ shutdown = do putStrLn "Shutting down"
+ cleanupNode s `catch` ignoreEx
signalQSem allDone
liftIO $ setShutdownAction s shutdown
_ <- liftIO $ installHandler sigINT (CatchOnce shutdown) Nothing
t <- liftIO . forkIO $ wait >> signalQSem allDone
liftIO $ waitQSem allDone
- liftIO $ killThread t `catch` \_ -> return ()
+ liftIO $ killThread t `catch` ignoreEx
View
@@ -1,4 +1,4 @@
-{-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE ScopedTypeVariables, BangPatterns #-}
-- |Utility functions for working with 'Topic's. These functions are
-- primarily combinators for fusing two 'Topic's in various ways.
module Ros.TopicUtil where

0 comments on commit 97613c8

Please sign in to comment.