diff --git a/Haxl/Core/Exception.hs b/Haxl/Core/Exception.hs
--- a/Haxl/Core/Exception.hs
+++ b/Haxl/Core/Exception.hs
@@ -100,7 +100,7 @@
 -- (generic transient failure) or 'CriticalError' (internal failure).
 --
 data HaxlException
-  = forall e. (Exception e, MiddleException e)
+  = forall e. (MiddleException e)
     => HaxlException
          (Maybe Stack)  -- filled in with the call stack when thrown,
                         -- if PROFILING is on
@@ -129,11 +129,11 @@
         ]
 
 haxlExceptionToException
-  :: (Exception e, MiddleException e) => e -> SomeException
+  :: (MiddleException e) => e -> SomeException
 haxlExceptionToException = toException . HaxlException Nothing
 
 haxlExceptionFromException
-  :: (Exception e, MiddleException e) => SomeException -> Maybe e
+  :: (MiddleException e) => SomeException -> Maybe e
 haxlExceptionFromException x = do
   HaxlException _ a <- fromException x
   cast a
diff --git a/Haxl/Core/Monad.hs b/Haxl/Core/Monad.hs
--- a/Haxl/Core/Monad.hs
+++ b/Haxl/Core/Monad.hs
@@ -11,7 +11,6 @@
 {-# LANGUAGE ExistentialQuantification #-}
 {-# LANGUAGE FlexibleInstances #-}
 {-# LANGUAGE GADTs #-}
-{-# LANGUAGE GeneralizedNewtypeDeriving #-}
 {-# LANGUAGE LambdaCase #-}
 {-# LANGUAGE MagicHash #-}
 {-# LANGUAGE MultiWayIf #-}
@@ -20,6 +19,11 @@
 {-# LANGUAGE RankNTypes #-}
 {-# LANGUAGE ScopedTypeVariables #-}
 {-# LANGUAGE TypeFamilies #-}
+#if __GLASGOW_HASKELL >= 800
+{-# OPTIONS_GHC -Wno-name-shadowing #-}
+#else
+{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
+#endif
 
 -- | The implementation of the 'Haxl' monad.  Most users should
 -- import "Haxl.Core" instead of importing this module directly.
@@ -183,7 +187,6 @@
 --
 newtype GenHaxl u a = GenHaxl
   { unHaxl :: Env u -> IORef (RequestStore u) -> IO (Result u a) }
-  deriving NFData
 
 -- | The result of a computation is either 'Done' with a value, 'Throw'
 -- with an exception, or 'Blocked' on the result of a data fetch with
diff --git a/Haxl/Core/Types.hs b/Haxl/Core/Types.hs
--- a/Haxl/Core/Types.hs
+++ b/Haxl/Core/Types.hs
@@ -16,6 +16,11 @@
 {-# LANGUAGE RecordWildCards #-}
 {-# LANGUAGE ScopedTypeVariables #-}
 {-# LANGUAGE TypeFamilies #-}
+#if __GLASGOW_HASKELL >= 800
+{-# OPTIONS_GHC -Wno-name-shadowing #-}
+#else
+{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
+#endif
 
 -- | Base types used by all of Haxl. Most users should import
 -- "Haxl.Core" instead of importing this module directly.
@@ -135,16 +140,24 @@
   , caching = 1
   }
 
+#if __GLASGOW_HASKELL__ >= 710
+#define FUNMONAD Monad m
+#else
+#define FUNMONAD (Functor m, Monad m)
+#endif
+
 -- | Runs an action if the tracing level is above the given threshold.
-ifTrace :: (Functor m, Monad m) => Flags -> Int -> m a -> m ()
+ifTrace :: FUNMONAD => Flags -> Int -> m a -> m ()
 ifTrace flags i = when (trace flags >= i) . void
 
 -- | Runs an action if the report level is above the given threshold.
-ifReport :: (Functor m, Monad m) => Flags -> Int -> m a -> m ()
+ifReport :: FUNMONAD => Flags -> Int -> m a -> m ()
 ifReport flags i = when (report flags >= i) . void
 
-ifProfiling :: (Functor m, Monad m) => Flags -> m a -> m ()
+ifProfiling :: FUNMONAD => Flags -> m a -> m ()
 ifProfiling flags = when (report flags >= 4) . void
+
+#undef FUNMONAD
 
 -- ---------------------------------------------------------------------------
 -- Stats
diff --git a/Haxl/Prelude.hs b/Haxl/Prelude.hs
--- a/Haxl/Prelude.hs
+++ b/Haxl/Prelude.hs
@@ -189,10 +189,11 @@
 sequence_ t = void $ sequenceA t
 
 -- | See 'mapM'.
-filterM :: (Applicative f, Monad f) => (a -> f Bool) -> [a] -> f [a]
-filterM pred xs = do
-  bools <- mapM pred xs
-  return [ x | (x,True) <- zip xs bools ]
+filterM :: (Applicative f) => (a -> f Bool) -> [a] -> f [a]
+filterM predicate xs =
+    filt <$> mapM predicate xs
+  where
+    filt bools = [ x | (x,True) <- zip xs bools ]
 
 --------------------------------------------------------------------------------
 
diff --git a/haxl.cabal b/haxl.cabal
--- a/haxl.cabal
+++ b/haxl.cabal
@@ -1,5 +1,5 @@
 name:                haxl
-version:             0.4.0.1
+version:             0.4.0.2
 synopsis:            A Haskell library for efficient, concurrent,
                      and concise data access.
 homepage:            https://github.com/facebook/Haxl
@@ -42,7 +42,7 @@
 library
 
   build-depends:
-    HUnit >= 1.2 && < 1.4,
+    HUnit >= 1.2 && < 1.6,
     aeson >= 0.6 && < 1.1,
     base == 4.*,
     binary >= 0.7 && < 0.9,
@@ -80,7 +80,6 @@
 
   ghc-options:
     -Wall
-    -fno-warn-name-shadowing
 
 
 test-suite test
diff --git a/tests/ExampleDataSource.hs b/tests/ExampleDataSource.hs
--- a/tests/ExampleDataSource.hs
+++ b/tests/ExampleDataSource.hs
@@ -154,4 +154,4 @@
 countAardvarks str = dataFetch (CountAardvarks str)
 
 listWombats :: Id -> GenHaxl () [Id]
-listWombats id = dataFetch (ListWombats id)
+listWombats i = dataFetch (ListWombats i)
diff --git a/tests/MonadBench.hs b/tests/MonadBench.hs
--- a/tests/MonadBench.hs
+++ b/tests/MonadBench.hs
@@ -6,7 +6,12 @@
 -- be found in the PATENTS file.
 
 -- | Benchmarking tool for core performance characteristics of the Haxl monad.
-
+{-# LANGUAGE CPP #-}
+#if __GLASGOW_HASKELL >= 800
+{-# OPTIONS_GHC -Wno-name-shadowing #-}
+#else
+{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
+#endif
 module MonadBench (main) where
 
 import Control.Monad
@@ -32,6 +37,7 @@
   let st = stateSet exstate stateEmpty
   initEnv st ()
 
+main :: IO ()
 main = do
   [test,n_] <- getArgs
   let n = read n_
@@ -49,7 +55,7 @@
        foldr andThen (return ()) (replicate n (listWombats 3))
     -- sequential, left-associated, distinct queries
     "seql" -> runHaxl env $ do
-       foldl andThen (return []) (map listWombats [1.. fromIntegral n])
+       _ <- foldl andThen (return []) (map listWombats [1.. fromIntegral n])
        return ()
     "tree" -> runHaxl env $ void $ tree n
     -- No memoization
