From fa5d8d418cdd9f23503337ec3bfd2617edcdfc82 Mon Sep 17 00:00:00 2001
From: Nikita Karetnikov <nikita@karetnikov.org>
Date: Thu, 22 Aug 2013 10:27:11 +0000
Subject: [PATCH 19/21] Use ScopedTypeVariables.

---
 src/TorDNSEL/Main.hsc |   22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/TorDNSEL/Main.hsc b/src/TorDNSEL/Main.hsc
index aa5636d..b95fa8d 100644
--- a/src/TorDNSEL/Main.hsc
+++ b/src/TorDNSEL/Main.hsc
@@ -1,4 +1,5 @@
-{-# LANGUAGE PatternGuards, BangPatterns, ForeignFunctionInterface, CPP #-}
+{-# LANGUAGE PatternGuards, BangPatterns, ForeignFunctionInterface, CPP,
+             ScopedTypeVariables #-}
 {-# OPTIONS_GHC -fno-warn-type-defaults -fno-warn-missing-fields
                 -fno-warn-orphans #-}
 
@@ -197,7 +198,7 @@ main = do
           verifyConfig args
     ["--reconfigure",runtimeDir] -> do
       sock <- connectToReconfigSocket runtimeDir
-        `E.catch` \e -> do
+        `E.catch` \(e :: E.SomeException) -> do
           hCat stderr "Connecting to reconfigure socket failed: " e '\n'
           exitWith $ fromSysExitCode Unavailable
       r <- E.handleJust ioErrors (\e -> do
@@ -334,10 +335,11 @@ runMainThread static initTestListeners initDNSListener initConf = do
   installHandler sigHUP (Catch hupHandler) Nothing
   installHandler sigINT (Catch $ termHandler sigINT) Nothing
 
-  initState <- E.handle (\e -> do log Error "Starting failed: " e
-                                  terminateLogger Nothing
-                                  closeSystemLogger
-                                  exitWith $ fromSysExitCode ConfigError) $ do
+  initState <- E.handle (\(e :: E.SomeException) -> do
+                            log Error "Starting failed: " e
+                            terminateLogger Nothing
+                            closeSystemLogger
+                            exitWith $ fromSysExitCode ConfigError) $ do
     initLogger <- initializeLogger initConf
     whenJust (cfChangeRootDirectory initConf) $ \dir ->
       log Notice "Chrooted in " (esc 256 $ B.pack dir) '.'
@@ -348,11 +350,11 @@ runMainThread static initTestListeners initDNSListener initConf = do
                       (((writeChan mainChan . Reconfigure) .) . curry Just)
     let cleanup = terminateReconfigServer Nothing initReconfig
     stats <- startStatsServer (statsSocket static)
-      `E.catch` \e -> cleanup >> E.throwIO e
+      `E.catch` \(e :: E.SomeException) -> cleanup >> E.throwIO e
     let cleanup' = cleanup >> terminateStatsServer Nothing stats
     netState <- initializeNetworkStateManager
                   (mkExitTestConfig static initTestListeners initConf) initConf
-      `E.catch` \e -> cleanup' >> E.throwIO e
+      `E.catch` \(e :: E.SomeException) -> cleanup' >> E.throwIO e
     dns <- startDNSServer (mkDNSServerConfig initDNSListener initConf)
     return $ State (Just initLogger) (Just initReconfig) (Just stats) netState
                    dns initTestListeners initDNSListener S.empty
@@ -412,7 +414,7 @@ handleMessage _ static conf s (Reconfigure reconf) = flip runStateT s $ do
 
       when (cfStateDirectory conf /= cfStateDirectory newConf') $
         liftIO $ checkDirectory Nothing Nothing (cfStateDirectory newConf')
-          `E.catch` \e -> do
+          `E.catch` \(e :: E.SomeException) -> do
             errorRespond $ cat "Preparing new state directory failed: " e
                                "; exiting gracefully."
             terminateProcess Can'tCreate static s Nothing
@@ -476,7 +478,7 @@ handleMessage mainChan static conf s (Exit tid reason)
                (showExitReason [] reason) "; restarting."
       newManager <- initializeNetworkStateManager
                       (mkExitTestConfig static (exitTestListeners s) conf) conf
-        `E.catch` \e -> do
+        `E.catch` \(e :: E.SomeException) -> do
           log Error "Restarting network state manager failed: " e
                     "; exiting gracefully."
           terminateProcess Internal static s Nothing
-- 
1.7.9.5

