diff --git a/c2hs/base/state/StateBase.hs b/c2hs/base/state/StateBase.hs
--- a/c2hs/base/state/StateBase.hs
+++ b/c2hs/base/state/StateBase.hs
@@ -58,6 +58,7 @@
 
 import Control.Applicative (Applicative(..))
 import Control.Monad (liftM, ap)
+import Control.Monad.Fail (MonadFail (..))
 
 import Position   (Position)
 import UNames     (NameSupply)
@@ -110,6 +111,8 @@
   (>>=)  = (+>=)
   (>>)   = (+>)
 
+instance MonadFail (PreCST e s) where
+  fail = error
 
 -- unwrapper coercion function (EXPORTED)
 --
diff --git a/c2hs/c/CParserMonad.hs b/c2hs/c/CParserMonad.hs
--- a/c2hs/c/CParserMonad.hs
+++ b/c2hs/c/CParserMonad.hs
@@ -63,6 +63,7 @@
 
 import Control.Applicative (Applicative(..))
 import Control.Monad (liftM, ap)
+import Control.Monad.Fail (MonadFail (..))
 import Data.Set  (Set)
 import qualified Data.Set as Set (fromList, insert, member, delete)
 
@@ -82,6 +83,9 @@
      }
 
 newtype P a = P { unP :: PState -> ParseResult a }
+
+instance MonadFail P where
+  fail m = getPos >>= \pos -> failP pos [m]
 
 instance Functor P where
   fmap = liftM
diff --git a/gtk2hs-buildtools.cabal b/gtk2hs-buildtools.cabal
--- a/gtk2hs-buildtools.cabal
+++ b/gtk2hs-buildtools.cabal
@@ -1,5 +1,5 @@
 Name:   gtk2hs-buildtools
-Version:        0.13.4.0
+Version:        0.13.5.0
 License:        GPL-2
 License-file:   COPYING
 Copyright:      (c) 2001-2010 The Gtk2Hs Team
@@ -44,6 +44,8 @@
                          filepath >= 1.3.0.0,
                          directory >= 1.2.0.0,
                          containers >= 0.5.5.1
+        if !impl(ghc >= 8.0)
+          build-depends: fail
         if impl(ghc >= 7.7)
           build-depends: hashtables
         build-tools:     alex >= 3.0.1, happy >= 1.18.9
