Skip to content
Browse files

Qualify Control.Exception imports.

In older versions of base, Prelude exported "catch". The qualified
lets us avoid warnings with older or newer versions of base.
  • Loading branch information...
1 parent d1be04d commit 65bf2c301d80e19d5f07394a663d716357d5c178 @acowley committed Feb 7, 2013
Showing with 13 additions and 11 deletions.
  1. +7 −6 src/Ros/RosTcp.hs
  2. +6 −5 src/Ros/RunNode.hs
View
13 src/Ros/RosTcp.hs
@@ -5,7 +5,7 @@ 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 qualified Control.Exception as E
import Control.Monad.Reader
import Data.Binary.Put (runPut, putWord32le)
import Data.Binary.Get (runGet, getWord32le)
@@ -88,20 +88,21 @@ acceptClients sock clients negotiate mkBuffer = forever acceptClient
let cleanup1 =
do debug "Closing client socket"
liftIO $
- shutdown client ShutdownBoth `catch`
- \(_::SomeException) -> return ()
+ shutdown client ShutdownBoth `E.catch`
+ \(_::E.SomeException) -> return ()
r <- ask
t <- liftIO . forkIO $
- serviceClient chan client `catch`
- \(_::SomeException) -> runReaderT cleanup1 r
+ serviceClient chan client `E.catch`
+ \(_::E.SomeException) -> runReaderT cleanup1 r
let cleanup2 = cleanup1 >>
(liftIO $ killThread t)
liftIO . atomically $
readTVar clients >>=
writeTVar clients . ((cleanup2,chan) :)
-- |Publish each item obtained from a 'Topic' to each connected client.
-pubStream :: RosBinary a => Topic IO a -> TVar [(b, RingChan ByteString)] -> Config ()
+pubStream :: RosBinary a
+ => Topic IO a -> TVar [(b, RingChan ByteString)] -> Config ()
pubStream t0 clients = liftIO $ go 0 t0
where go !n t = do (x, t') <- runTopic t
let bytes = runPut $ putMsg n x
View
11 src/Ros/RunNode.hs
@@ -1,7 +1,7 @@
module Ros.RunNode (runNode) where
import Control.Concurrent (readMVar,forkIO, killThread)
import qualified Control.Concurrent.SSem as Sem
-import Control.Exception (catch, SomeException)
+import qualified Control.Exception as E
import Control.Monad.IO.Class
import System.Posix.Signals (installHandler, Handler(..), sigINT)
import Ros.Core.RosTypes
@@ -49,13 +49,14 @@ runNode name s = do (wait, _port) <- liftIO $ runSlave s
registerNode name s
debug "Spinning"
allDone <- liftIO $ Sem.new 0
- let ignoreEx :: SomeException -> IO ()
+ let ignoreEx :: E.SomeException -> IO ()
ignoreEx _ = return ()
shutdown = do putStrLn "Shutting down"
- cleanupNode s `catch` ignoreEx
+ cleanupNode s `E.catch` ignoreEx
Sem.signal allDone
liftIO $ setShutdownAction s shutdown
- _ <- liftIO $ installHandler sigINT (CatchOnce shutdown) Nothing
+ _ <- liftIO $
+ installHandler sigINT (CatchOnce shutdown) Nothing
t <- liftIO . forkIO $ wait >> Sem.signal allDone
liftIO $ Sem.wait allDone
- liftIO $ killThread t `catch` ignoreEx
+ liftIO $ killThread t `E.catch` ignoreEx

0 comments on commit 65bf2c3

Please sign in to comment.
Something went wrong with that request. Please try again.