summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/genprimopcode/ParserM.hs11
1 files changed, 11 insertions, 0 deletions
diff --git a/utils/genprimopcode/ParserM.hs b/utils/genprimopcode/ParserM.hs
index 190ec0edc0..1691bbaefb 100644
--- a/utils/genprimopcode/ParserM.hs
+++ b/utils/genprimopcode/ParserM.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
module ParserM (
-- Parser Monad
ParserM(..), AlexInput, run_parser,
@@ -18,7 +19,13 @@ module ParserM (
) where
import Control.Applicative
+
+#if __GLASGOW_HASKELL__ >= 806
+import Prelude hiding (fail)
+import Control.Monad.Fail (MonadFail (..))
+#else
import Prelude
+#endif
import Control.Monad (ap, liftM)
import Data.Word (Word8)
@@ -42,6 +49,10 @@ instance Monad ParserM where
Left err ->
Left err
return a = ParserM $ \i s -> Right (i, s, a)
+
+#if __GLASGOW_HASKELL__ >= 806
+instance MonadFail ParserM where
+#endif
fail err = ParserM $ \_ _ -> Left err
run_parser :: ParserM a -> (String -> Either String a)