about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/haskell-modules/patches/proto-lens-0.5.1.0.patch
blob: b50d3f1cdbfc7d4519c0c7ba348bb91477bfc6ab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
diff --git a/src/Data/ProtoLens/Encoding/Parser/Internal.hs b/src/Data/ProtoLens/Encoding/Parser/Internal.hs
index 30eeaad..f2703e7 100644
--- a/src/Data/ProtoLens/Encoding/Parser/Internal.hs
+++ b/src/Data/ProtoLens/Encoding/Parser/Internal.hs
@@ -1,4 +1,5 @@
 {-# LANGUAGE LambdaCase #-}
+{-# LANGUAGE CPP #-}
 -- | Definition of the parsing monad, plus internal
 -- unsafe functions.
 module Data.ProtoLens.Encoding.Parser.Internal
@@ -36,8 +37,11 @@ instance Applicative Parser where
     (<*>) = ap
 
 instance Monad Parser where
-    fail s = Parser $ \_ _ -> return $ ParseFailure s
     return = pure
     Parser f >>= g = Parser $ \end pos -> f end pos >>= \case
         ParseSuccess pos' x -> unParser (g x) end pos'
         ParseFailure s -> return $ ParseFailure s
+#if MIN_VERSION_base(4,13,0)
+instance MonadFail Parser where
+#endif
+    fail s = Parser $ \_ _ -> return $ ParseFailure s