diff options
| -rw-r--r-- | src/compiler/GF/Compile/TypeCheck/ConcreteNew.hs | 14 | ||||
| -rw-r--r-- | src/compiler/GF/Data/BacktrackM.hs | 2 | ||||
| -rw-r--r-- | src/compiler/GF/Data/ErrM.hs | 15 | ||||
| -rw-r--r-- | src/compiler/GF/Grammar/Lexer.x | 10 |
4 files changed, 5 insertions, 36 deletions
diff --git a/src/compiler/GF/Compile/TypeCheck/ConcreteNew.hs b/src/compiler/GF/Compile/TypeCheck/ConcreteNew.hs index fab3173dc..3b9e62d04 100644 --- a/src/compiler/GF/Compile/TypeCheck/ConcreteNew.hs +++ b/src/compiler/GF/Compile/TypeCheck/ConcreteNew.hs @@ -19,10 +19,6 @@ import GF.Text.Pretty import Data.List (nub, (\\), tails) import qualified Data.IntMap as IntMap import Data.Maybe(fromMaybe,isNothing) -#if !MIN_VERSION_base(4,11,0) --- Control.Monad.Fail import is redundant since GHC 8.8.1 -import qualified Control.Monad.Fail as Fail -#endif checkLType :: GlobalEnv -> Term -> Type -> Check (Term, Type) checkLType ge t ty = runTcM $ do @@ -651,16 +647,8 @@ instance Monad TcM where TcOk x ms msgs -> unTcM (g x) ms msgs TcFail msgs -> TcFail msgs) -#if !(MIN_VERSION_base(4,13,0)) +instance MonadFail TcM where fail = tcError . pp -#endif - -instance Fail.MonadFail TcM where - fail = tcError . pp - - --- Control.Monad.Fail import will become redundant in GHC 8.8+ -import qualified Control.Monad.Fail as Fail instance Applicative TcM where diff --git a/src/compiler/GF/Data/BacktrackM.hs b/src/compiler/GF/Data/BacktrackM.hs index f5ae63997..87ea4dc5a 100644 --- a/src/compiler/GF/Data/BacktrackM.hs +++ b/src/compiler/GF/Data/BacktrackM.hs @@ -69,6 +69,8 @@ instance Monad (BacktrackM s) where return a = BM (\c s b -> c a s b) BM m >>= k = BM (\c s b -> m (\a s b -> unBM (k a) c s b) s b) where unBM (BM m) = m + +instance MonadFail (BacktrackM s) where fail _ = mzero instance Functor (BacktrackM s) where diff --git a/src/compiler/GF/Data/ErrM.hs b/src/compiler/GF/Data/ErrM.hs index 0cef54816..5ea7f0734 100644 --- a/src/compiler/GF/Data/ErrM.hs +++ b/src/compiler/GF/Data/ErrM.hs @@ -16,10 +16,6 @@ module GF.Data.ErrM where import Control.Monad (MonadPlus(..),ap) import Control.Applicative -#if !MIN_VERSION_base(4,11,0) --- Control.Monad.Fail import is redundant since GHC 8.8.1 -import qualified Control.Monad.Fail as Fail -#endif -- | Like 'Maybe' type with error msgs data Err a = Ok a | Bad String @@ -40,17 +36,8 @@ instance Monad Err where Ok a >>= f = f a Bad s >>= f = Bad s -#if !(MIN_VERSION_base(4,11,0)) +instance MonadFail Err where fail = Bad -#endif - -instance Fail.MonadFail Err where - fail = Bad - --- Control.Monad.Fail import will become redundant in GHC 8.8+ -import qualified Control.Monad.Fail as Fail - - diff --git a/src/compiler/GF/Grammar/Lexer.x b/src/compiler/GF/Grammar/Lexer.x index c19a32e3b..57577ba16 100644 --- a/src/compiler/GF/Grammar/Lexer.x +++ b/src/compiler/GF/Grammar/Lexer.x @@ -19,9 +19,6 @@ import qualified Data.Map as Map import Data.Word(Word8) import Data.Char(readLitChar) --import Debug.Trace(trace) - --- Control.Monad.Fail import will become redundant in GHC 8.8+ -import qualified Control.Monad.Fail as Fail } @@ -287,16 +284,11 @@ instance Monad P where POk s a -> unP (k a) s PFailed posn err -> PFailed posn err -#if !(MIN_VERSION_base(4,13,0)) - fail msg = P $ \(_,AI posn _ _) -> PFailed posn msg -#endif -instance Fail.MonadFail P where +instance MonadFail P where fail msg = P $ \(_,AI posn _ _) -> PFailed posn msg - - runP :: P a -> BS.ByteString -> Either (Posn,String) a runP p bs = snd <$> runP' p (Pn 1 0,bs) |
