diff --git a/nix-diff.cabal b/nix-diff.cabal
--- a/nix-diff.cabal
+++ b/nix-diff.cabal
@@ -1,5 +1,5 @@
 name:                nix-diff
-version:             1.0.8
+version:             1.0.9
 synopsis:            Explain why two Nix derivations differ
 description:         This package provides a @nix-diff@ executable which
                      explains why two Nix derivations (i.e. @*.drv@ files)
@@ -21,10 +21,10 @@
   build-depends:       base                 >= 4.9      && < 5
                      , attoparsec           >= 0.13     && < 0.14
                      , containers           >= 0.5      && < 0.7
-                     , Diff                 >= 0.3      && < 0.4
+                     , Diff                 >= 0.3      && < 0.5
                      , text                 >= 1.2      && < 1.3
                      , system-filepath      >= 0.4      && < 0.5
-                     , optparse-applicative >= 0.14.0.0 && < 0.15
+                     , optparse-applicative >= 0.14.0.0 && < 0.16
                      , nix-derivation       >= 1.0      && < 1.1
                      , mtl                  >= 2.2      && < 2.3
                      , unix                                < 2.8
diff --git a/src/Main.hs b/src/Main.hs
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -3,6 +3,7 @@
 {-# LANGUAGE GeneralizedNewtypeDeriving #-}
 {-# LANGUAGE NamedFieldPuns             #-}
 {-# LANGUAGE OverloadedStrings          #-}
+{-# LANGUAGE CPP                        #-}
 
 module Main where
 
@@ -39,6 +40,10 @@
 import qualified System.Posix.IO
 import qualified System.Posix.Terminal
 
+#if MIN_VERSION_base(4,9,0)
+import Control.Monad.Fail (MonadFail)
+#endif
+
 data Color = Always | Auto | Never
 
 parseColor :: Parser Color
@@ -130,6 +135,9 @@
     , MonadReader Context
     , MonadState Status
     , MonadIO
+#if MIN_VERSION_base(4,9,0)
+    , MonadFail
+#endif
     )
 
 echo :: Text -> Diff ()
