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