Commit 8a3877ae authored by Duncan Coutts's avatar Duncan Coutts

Fix base 4 exceptions in #ifdef WIN32 code section

parent c6c1d6ec
......@@ -24,7 +24,9 @@ import System.Win32.Registry
( hKEY_CURRENT_USER, regOpenKey, regCloseKey
, regQueryValue, regQueryValueEx )
import Control.Exception
( handle, bracket )
( bracket )
import Distribution.Compat.Exception
( handleIO )
import Foreign
( toBool, Storable(peek, sizeOf), castPtr, alloca )
#endif
......@@ -46,7 +48,7 @@ import qualified System.FilePath.Posix as FilePath.Posix
proxyString, envProxyString, registryProxyString :: IO (Maybe String)
#ifdef WIN32
-- read proxy settings from the windows registry
registryProxyString = handle (\_ -> return Nothing) $
registryProxyString = handleIO (\_ -> return Nothing) $
bracket (regOpenKey hive path) regCloseKey $ \hkey -> do
enable <- fmap toBool $ regQueryValueDWORD hkey "ProxyEnable"
if enable
......
......@@ -7,6 +7,7 @@ module Distribution.Compat.Exception (
SomeException,
onException,
catchIO,
handleIO,
catchExit,
throwIOIO
) where
......@@ -42,6 +43,9 @@ catchIO = Exception.catch
catchIO = Exception.catchJust Exception.ioErrors
#endif
handleIO :: (Exception.IOException -> IO a) -> IO a -> IO a
handleIO = flip catchIO
catchExit :: IO a -> (ExitCode -> IO a) -> IO a
#if MIN_VERSION_base(4,0,0)
catchExit = Exception.catch
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment