summaryrefslogtreecommitdiff
path: root/compiler/utils
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/utils')
-rw-r--r--compiler/utils/Binary.hs4
-rw-r--r--compiler/utils/Exception.hs6
-rw-r--r--compiler/utils/IOEnv.hs2
-rw-r--r--compiler/utils/MonadUtils.hs6
-rw-r--r--compiler/utils/Panic.lhs4
5 files changed, 13 insertions, 9 deletions
diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs
index cbfec74cff..11f3b12317 100644
--- a/compiler/utils/Binary.hs
+++ b/compiler/utils/Binary.hs
@@ -146,11 +146,11 @@ class Binary a where
-- define one of put_, put. Use of put_ is recommended because it
-- is more likely that tail-calls can kick in, and we rarely need the
-- position return value.
- put_ bh a = do put bh a; return ()
+ put_ bh a = do _ <- put bh a; return ()
put bh a = do p <- tellBin bh; put_ bh a; return p
putAt :: Binary a => BinHandle -> Bin a -> a -> IO ()
-putAt bh p x = do seekBin bh p; put bh x; return ()
+putAt bh p x = do seekBin bh p; put_ bh x; return ()
getAt :: Binary a => BinHandle -> Bin a -> IO a
getAt bh p = do seekBin bh p; get bh
diff --git a/compiler/utils/Exception.hs b/compiler/utils/Exception.hs
index c51c2329ca..3c7600515a 100644
--- a/compiler/utils/Exception.hs
+++ b/compiler/utils/Exception.hs
@@ -62,13 +62,13 @@ class Monad m => ExceptionMonad m where
gblock (do
a <- before
r <- gunblock (thing a) `gonException` after a
- after a
+ _ <- after a
return r)
a `gfinally` sequel =
gblock (do
r <- gunblock a `gonException` sequel
- sequel
+ _ <- sequel
return r)
instance ExceptionMonad IO where
@@ -89,6 +89,6 @@ ghandle = flip gcatch
-- second argument is executed and the exception is raised again.
gonException :: (ExceptionMonad m) => m a -> m b -> m a
gonException ioA cleanup = ioA `gcatch` \e ->
- do cleanup
+ do _ <- cleanup
throw (e :: SomeException)
diff --git a/compiler/utils/IOEnv.hs b/compiler/utils/IOEnv.hs
index 305e30eed7..b81b2e8fde 100644
--- a/compiler/utils/IOEnv.hs
+++ b/compiler/utils/IOEnv.hs
@@ -66,7 +66,7 @@ thenM (IOEnv m) f = IOEnv (\ env -> do { r <- m env ;
unIOEnv (f r) env })
thenM_ :: IOEnv env a -> IOEnv env b -> IOEnv env b
-thenM_ (IOEnv m) f = IOEnv (\ env -> do { m env ; unIOEnv f env })
+thenM_ (IOEnv m) f = IOEnv (\ env -> do { _ <- m env ; unIOEnv f env })
failM :: IOEnv env a
failM = IOEnv (\ _ -> throwIO IOEnvFailure)
diff --git a/compiler/utils/MonadUtils.hs b/compiler/utils/MonadUtils.hs
index 733eda1700..9b364aebb7 100644
--- a/compiler/utils/MonadUtils.hs
+++ b/compiler/utils/MonadUtils.hs
@@ -18,7 +18,7 @@ module MonadUtils
, concatMapM
, mapMaybeM
, anyM, allM
- , foldlM, foldrM
+ , foldlM, foldlM_, foldrM
, maybeMapM
) where
@@ -146,6 +146,10 @@ allM f (b:bs) = (f b) >>= (\bv -> if bv then allM f bs else return False)
foldlM :: (Monad m) => (a -> b -> m a) -> a -> [b] -> m a
foldlM = foldM
+-- | Monadic version of foldl that discards its result
+foldlM_ :: (Monad m) => (a -> b -> m a) -> a -> [b] -> m ()
+foldlM_ = foldM_
+
-- | Monadic version of foldr
foldrM :: (Monad m) => (b -> a -> m a) -> a -> [b] -> m a
foldrM _ z [] = return z
diff --git a/compiler/utils/Panic.lhs b/compiler/utils/Panic.lhs
index a49a68d623..4f78aabc24 100644
--- a/compiler/utils/Panic.lhs
+++ b/compiler/utils/Panic.lhs
@@ -190,8 +190,8 @@ installSignalHandlers = do
(thread:_) -> throwTo thread interrupt_exn
--
#if !defined(mingw32_HOST_OS)
- installHandler sigQUIT (Catch interrupt) Nothing
- installHandler sigINT (Catch interrupt) Nothing
+ _ <- installHandler sigQUIT (Catch interrupt) Nothing
+ _ <- installHandler sigINT (Catch interrupt) Nothing
return ()
#else
-- GHC 6.3+ has support for console events on Windows