diff options
author | Herbert Valerio Riedel <hvr@gnu.org> | 2018-11-10 01:12:52 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2019-03-22 10:34:51 -0400 |
commit | ab51bee40c82cd552bcf13e24b67d43f3b8d25f3 (patch) | |
tree | a75a4102576dad50af44e342fb9152e7270792eb | |
parent | cd07086ada34888c08585f4dc98a961618748ed0 (diff) | |
download | haskell-ab51bee40c82cd552bcf13e24b67d43f3b8d25f3.tar.gz |
base: Remove `Monad(fail)` method and reexport `MonadFail(fail)` instead
As per https://prime.haskell.org/wiki/Libraries/Proposals/MonadFail
Coauthored-by: Ben Gamari <ben@well-typed.com>
153 files changed, 229 insertions, 801 deletions
diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in index a02ce1297d..fe43fa9b46 100644 --- a/compiler/ghc.cabal.in +++ b/compiler/ghc.cabal.in @@ -87,7 +87,6 @@ Library GHC-Options: -Wall -Wno-name-shadowing -Wnoncanonical-monad-instances - -Wnoncanonical-monadfail-instances -Wnoncanonical-monoid-instances if flag(ghci) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index ba4cfe726a..fdc83fa94e 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -823,7 +823,7 @@ data WarningFlag = | Opt_WarnDeferredTypeErrors | Opt_WarnDeferredOutOfScopeVariables | Opt_WarnNonCanonicalMonadInstances -- since 8.0 - | Opt_WarnNonCanonicalMonadFailInstances -- since 8.0 + | Opt_WarnNonCanonicalMonadFailInstances -- since 8.0, removed 8.8 | Opt_WarnNonCanonicalMonoidInstances -- since 8.0 | Opt_WarnMissingPatternSynonymSignatures -- since 8.0 | Opt_WarnUnrecognisedWarningFlags -- since 8.0 @@ -2245,7 +2245,6 @@ languageExtensions (Just Haskell98) = [LangExt.ImplicitPrelude, -- See Note [When is StarIsType enabled] LangExt.StarIsType, - LangExt.MonadFailDesugaring, LangExt.MonomorphismRestriction, LangExt.NPlusKPatterns, LangExt.DatatypeContexts, @@ -2262,7 +2261,6 @@ languageExtensions (Just Haskell2010) = [LangExt.ImplicitPrelude, -- See Note [When is StarIsType enabled] LangExt.StarIsType, - LangExt.MonadFailDesugaring, LangExt.MonomorphismRestriction, LangExt.DatatypeContexts, LangExt.TraditionalRecordSyntax, @@ -4007,8 +4005,9 @@ wWarningFlagsDeps = [ flagSpec "name-shadowing" Opt_WarnNameShadowing, flagSpec "noncanonical-monad-instances" Opt_WarnNonCanonicalMonadInstances, - flagSpec "noncanonical-monadfail-instances" - Opt_WarnNonCanonicalMonadFailInstances, + depFlagSpec "noncanonical-monadfail-instances" + Opt_WarnNonCanonicalMonadInstances + "fail is no longer a method of Monad", flagSpec "noncanonical-monoid-instances" Opt_WarnNonCanonicalMonoidInstances, flagSpec "orphans" Opt_WarnOrphans, @@ -4392,7 +4391,8 @@ xFlagsDeps = [ flagSpec "LiberalTypeSynonyms" LangExt.LiberalTypeSynonyms, flagSpec "MagicHash" LangExt.MagicHash, flagSpec "MonadComprehensions" LangExt.MonadComprehensions, - flagSpec "MonadFailDesugaring" LangExt.MonadFailDesugaring, + depFlagSpec "MonadFailDesugaring" LangExt.MonadFailDesugaring + "MonadFailDesugaring is now the default behavior", flagSpec "MonoLocalBinds" LangExt.MonoLocalBinds, depFlagSpecCond "MonoPatBinds" LangExt.MonoPatBinds id diff --git a/compiler/prelude/PrelNames.hs b/compiler/prelude/PrelNames.hs index 600eb2ba4d..4a104c63a9 100644 --- a/compiler/prelude/PrelNames.hs +++ b/compiler/prelude/PrelNames.hs @@ -314,7 +314,7 @@ basicKnownKeyNames returnMName, joinMName, -- MonadFail - monadFailClassName, failMName, failMName_preMFP, + monadFailClassName, failMName, -- MonadFix monadFixClassName, mfixName, @@ -669,13 +669,12 @@ map_RDR, append_RDR :: RdrName map_RDR = nameRdrName mapName append_RDR = nameRdrName appendName -foldr_RDR, build_RDR, returnM_RDR, bindM_RDR, failM_RDR_preMFP, - failM_RDR :: RdrName +foldr_RDR, build_RDR, returnM_RDR, bindM_RDR, failM_RDR + :: RdrName foldr_RDR = nameRdrName foldrName build_RDR = nameRdrName buildName returnM_RDR = nameRdrName returnMName bindM_RDR = nameRdrName bindMName -failM_RDR_preMFP = nameRdrName failMName_preMFP failM_RDR = nameRdrName failMName left_RDR, right_RDR :: RdrName @@ -1018,12 +1017,11 @@ functorClassName = clsQual gHC_BASE (fsLit "Functor") functorClassKey fmapName = varQual gHC_BASE (fsLit "fmap") fmapClassOpKey -- Class Monad -monadClassName, thenMName, bindMName, returnMName, failMName_preMFP :: Name +monadClassName, thenMName, bindMName, returnMName :: Name monadClassName = clsQual gHC_BASE (fsLit "Monad") monadClassKey thenMName = varQual gHC_BASE (fsLit ">>") thenMClassOpKey bindMName = varQual gHC_BASE (fsLit ">>=") bindMClassOpKey returnMName = varQual gHC_BASE (fsLit "return") returnMClassOpKey -failMName_preMFP = varQual gHC_BASE (fsLit "fail") failMClassOpKey_preMFP -- Class MonadFail monadFailClassName, failMName :: Name @@ -2253,8 +2251,7 @@ unboundKey = mkPreludeMiscIdUnique 158 fromIntegerClassOpKey, minusClassOpKey, fromRationalClassOpKey, enumFromClassOpKey, enumFromThenClassOpKey, enumFromToClassOpKey, enumFromThenToClassOpKey, eqClassOpKey, geClassOpKey, negateClassOpKey, - failMClassOpKey_preMFP, bindMClassOpKey, thenMClassOpKey, returnMClassOpKey, - fmapClassOpKey + bindMClassOpKey, thenMClassOpKey, returnMClassOpKey, fmapClassOpKey :: Unique fromIntegerClassOpKey = mkPreludeMiscIdUnique 160 minusClassOpKey = mkPreludeMiscIdUnique 161 @@ -2266,7 +2263,6 @@ enumFromThenToClassOpKey = mkPreludeMiscIdUnique 166 eqClassOpKey = mkPreludeMiscIdUnique 167 geClassOpKey = mkPreludeMiscIdUnique 168 negateClassOpKey = mkPreludeMiscIdUnique 169 -failMClassOpKey_preMFP = mkPreludeMiscIdUnique 170 bindMClassOpKey = mkPreludeMiscIdUnique 171 -- (>>=) thenMClassOpKey = mkPreludeMiscIdUnique 172 -- (>>) fmapClassOpKey = mkPreludeMiscIdUnique 173 diff --git a/compiler/rename/RnExpr.hs b/compiler/rename/RnExpr.hs index b74b557f49..dd38feb367 100644 --- a/compiler/rename/RnExpr.hs +++ b/compiler/rename/RnExpr.hs @@ -2100,11 +2100,6 @@ badIpBinds what binds --------- -lookupSyntaxMonadFailOpName :: Bool -> RnM (SyntaxExpr GhcRn, FreeVars) -lookupSyntaxMonadFailOpName monadFailEnabled - | monadFailEnabled = lookupSyntaxName failMName - | otherwise = lookupSyntaxName failMName_preMFP - monadFailOp :: LPat GhcPs -> HsStmtContext Name -> RnM (SyntaxExpr GhcRn, FreeVars) @@ -2146,14 +2141,14 @@ So, in this case, we synthesize the function -} getMonadFailOp :: RnM (SyntaxExpr GhcRn, FreeVars) -- Syntax expr fail op getMonadFailOp - = do { xMonadFailEnabled <- fmap (xopt LangExt.MonadFailDesugaring) getDynFlags - ; xOverloadedStrings <- fmap (xopt LangExt.OverloadedStrings) getDynFlags + = do { xOverloadedStrings <- fmap (xopt LangExt.OverloadedStrings) getDynFlags ; xRebindableSyntax <- fmap (xopt LangExt.RebindableSyntax) getDynFlags - ; reallyGetMonadFailOp xRebindableSyntax xOverloadedStrings xMonadFailEnabled } + ; reallyGetMonadFailOp xRebindableSyntax xOverloadedStrings + } where - reallyGetMonadFailOp rebindableSyntax overloadedStrings monadFailEnabled + reallyGetMonadFailOp rebindableSyntax overloadedStrings | rebindableSyntax && overloadedStrings = do - (failExpr, failFvs) <- lookupSyntaxMonadFailOpName monadFailEnabled + (failExpr, failFvs) <- lookupSyntaxName failMName (fromStringExpr, fromStringFvs) <- lookupSyntaxName fromStringName let arg_lit = fsLit "arg" arg_name = mkSystemVarName (mkVarOccUnique arg_lit) arg_lit @@ -2167,4 +2162,4 @@ getMonadFailOp let failAfterFromStringSynExpr :: SyntaxExpr GhcRn = mkSyntaxExpr failAfterFromStringExpr return (failAfterFromStringSynExpr, failFvs `plusFV` fromStringFvs) - | otherwise = lookupSyntaxMonadFailOpName monadFailEnabled + | otherwise = lookupSyntaxName failMName diff --git a/compiler/rename/RnSource.hs b/compiler/rename/RnSource.hs index 5181b7f2ed..e7ff909c02 100644 --- a/compiler/rename/RnSource.hs +++ b/compiler/rename/RnSource.hs @@ -43,7 +43,6 @@ import Module import HscTypes ( Warnings(..), plusWarns ) import PrelNames ( applicativeClassName, pureAName, thenAName , monadClassName, returnMName, thenMName - , monadFailClassName, failMName, failMName_preMFP , semigroupClassName, sappendName , monoidClassName, mappendName ) @@ -457,9 +456,6 @@ checkCanonicalInstances cls poly_ty mbinds = do whenWOptM Opt_WarnNonCanonicalMonadInstances checkCanonicalMonadInstances - whenWOptM Opt_WarnNonCanonicalMonadFailInstances - checkCanonicalMonadFailInstances - whenWOptM Opt_WarnNonCanonicalMonoidInstances checkCanonicalMonoidInstances @@ -510,45 +506,6 @@ checkCanonicalInstances cls poly_ty mbinds = do | otherwise = return () - -- | Warn about unsound/non-canonical 'Monad'/'MonadFail' instance - -- declarations. Specifically, the following conditions are verified: - -- - -- In 'Monad' instances declarations: - -- - -- * If 'fail' is overridden it must be canonical - -- (i.e. @fail = Control.Monad.Fail.fail@) - -- - -- In 'MonadFail' instance declarations: - -- - -- * Warn if 'fail' is defined backwards - -- (i.e. @fail = Control.Monad.fail@). - -- - checkCanonicalMonadFailInstances - | cls == monadFailClassName = do - forM_ (bagToList mbinds) $ \(dL->L loc mbind) -> setSrcSpan loc $ do - case mbind of - FunBind { fun_id = (dL->L _ name) - , fun_matches = mg } - | name == failMName, isAliasMG mg == Just failMName_preMFP - -> addWarnNonCanonicalMethod1 - Opt_WarnNonCanonicalMonadFailInstances "fail" - "Control.Monad.fail" - - _ -> return () - - | cls == monadClassName = do - forM_ (bagToList mbinds) $ \(dL->L loc mbind) -> setSrcSpan loc $ do - case mbind of - FunBind { fun_id = (dL->L _ name) - , fun_matches = mg } - | name == failMName_preMFP, isAliasMG mg /= Just failMName - -> addWarnNonCanonicalMethod2 - Opt_WarnNonCanonicalMonadFailInstances "fail" - "Control.Monad.Fail.fail" - _ -> return () - - | otherwise = return () - -- | Check whether Monoid(mappend) is defined in terms of -- Semigroup((<>)) (and not the other way round). Specifically, -- the following conditions are verified: diff --git a/compiler/simplCore/SimplCore.hs b/compiler/simplCore/SimplCore.hs index 7f2a0ea589..ade9816a1b 100644 --- a/compiler/simplCore/SimplCore.hs +++ b/compiler/simplCore/SimplCore.hs @@ -943,18 +943,18 @@ shortOutIndirections binds makeIndEnv :: [CoreBind] -> IndEnv makeIndEnv binds - = foldr add_bind emptyVarEnv binds + = foldl' add_bind emptyVarEnv binds where - add_bind :: CoreBind -> IndEnv -> IndEnv - add_bind (NonRec exported_id rhs) env = add_pair (exported_id, rhs) env - add_bind (Rec pairs) env = foldr add_pair env pairs + add_bind :: IndEnv -> CoreBind -> IndEnv + add_bind env (NonRec exported_id rhs) = add_pair env (exported_id, rhs) + add_bind env (Rec pairs) = foldl' add_pair env pairs - add_pair :: (Id,CoreExpr) -> IndEnv -> IndEnv - add_pair (exported_id, exported) env + add_pair :: IndEnv -> (Id,CoreExpr) -> IndEnv + add_pair env (exported_id, exported) | (ticks, Var local_id) <- stripTicksTop tickishFloatable exported , shortMeOut env exported_id local_id = extendVarEnv env local_id (exported_id, ticks) - add_pair _ env = env + add_pair env _ = env ----------------- shortMeOut :: IndEnv -> Id -> Id -> Bool diff --git a/compiler/typecheck/TcMatches.hs b/compiler/typecheck/TcMatches.hs index 48410e0a7c..6b727ed5aa 100644 --- a/compiler/typecheck/TcMatches.hs +++ b/compiler/typecheck/TcMatches.hs @@ -42,9 +42,6 @@ import TcEvidence import Outputable import Util import SrcLoc -import DynFlags -import PrelNames (monadFailClassName) -import qualified GHC.LanguageExtensions as LangExt -- Create chunkified tuple tybes for monad comprehensions import MkCore @@ -940,43 +937,8 @@ tcMonadFailOp orig pat fail_op res_ty = return noSyntaxExpr | otherwise - = do { -- Issue MonadFail warnings - rebindableSyntax <- xoptM LangExt.RebindableSyntax - ; desugarFlag <- xoptM LangExt.MonadFailDesugaring - ; missingWarning <- woptM Opt_WarnMissingMonadFailInstances - ; if | rebindableSyntax && desugarFlag && missingWarning - -> warnRebindableClash pat - | not desugarFlag && missingWarning - -> emitMonadFailConstraint pat res_ty - | otherwise - -> return () - - -- Get the fail op itself - ; snd <$> (tcSyntaxOp orig fail_op [synKnownType stringTy] - (mkCheckExpType res_ty) $ \_ -> return ()) } - -emitMonadFailConstraint :: LPat GhcTcId -> TcType -> TcRn () -emitMonadFailConstraint pat res_ty - = do { -- We expect res_ty to be of form (monad_ty arg_ty) - (_co, (monad_ty, _arg_ty)) <- matchExpectedAppTy res_ty - - -- Emit (MonadFail m), but ignore the evidence; it's - -- just there to generate a warning - ; monadFailClass <- tcLookupClass monadFailClassName - ; _ <- emitWanted (FailablePattern pat) - (mkClassPred monadFailClass [monad_ty]) - ; return () } - -warnRebindableClash :: LPat GhcTcId -> TcRn () -warnRebindableClash pattern = addWarnAt - (Reason Opt_WarnMissingMonadFailInstances) - (getLoc pattern) - (text "The failable pattern" <+> quotes (ppr pattern) - $$ - nest 2 (text "is used together with -XRebindableSyntax." - <+> text "If this is intentional," - $$ - text "compile with -Wno-missing-monadfail-instances.")) + = snd <$> (tcSyntaxOp orig fail_op [synKnownType stringTy] + (mkCheckExpType res_ty) $ \_ -> return ()) {- Note [Treat rebindable syntax first] diff --git a/ghc/ghc-bin.cabal.in b/ghc/ghc-bin.cabal.in index f00b7946f9..0000a1ee3f 100644 --- a/ghc/ghc-bin.cabal.in +++ b/ghc/ghc-bin.cabal.in @@ -51,7 +51,6 @@ Executable ghc GHC-Options: -Wall -Wnoncanonical-monad-instances - -Wnoncanonical-monadfail-instances -Wnoncanonical-monoid-instances if flag(ghci) diff --git a/libraries/base/Control/Monad.hs b/libraries/base/Control/Monad.hs index 8223ec73d1..433d176eb1 100644 --- a/libraries/base/Control/Monad.hs +++ b/libraries/base/Control/Monad.hs @@ -19,7 +19,8 @@ module Control.Monad -- * Functor and monad classes Functor(fmap) - , Monad((>>=), (>>), return, fail) + , Monad((>>=), (>>), return) + , MonadFail(fail) , MonadPlus(mzero, mplus) -- * Functions @@ -75,6 +76,7 @@ module Control.Monad , (<$!>) ) where +import Control.Monad.Fail ( MonadFail(fail) ) import Data.Foldable ( Foldable, sequence_, sequenceA_, msum, mapM_, foldlM, forM_ ) import Data.Functor ( void, (<$>) ) import Data.Traversable ( forM, mapM, traverse, sequence, sequenceA ) diff --git a/libraries/base/Control/Monad/ST/Lazy/Imp.hs b/libraries/base/Control/Monad/ST/Lazy/Imp.hs index f8d35b9953..5bb1a06caf 100644 --- a/libraries/base/Control/Monad/ST/Lazy/Imp.hs +++ b/libraries/base/Control/Monad/ST/Lazy/Imp.hs @@ -180,9 +180,6 @@ instance Applicative (ST s) where -- | @since 2.01 instance Monad (ST s) where - - fail s = errorWithoutStackTrace s - (>>) = (*>) m >>= k = ST $ \ s -> diff --git a/libraries/base/GHC/Base.hs b/libraries/base/GHC/Base.hs index 6b606d32ed..60a485c9bd 100644 --- a/libraries/base/GHC/Base.hs +++ b/libraries/base/GHC/Base.hs @@ -664,17 +664,6 @@ class Applicative m => Monad m where return :: a -> m a return = pure - -- | Fail with a message. This operation is not part of the - -- mathematical definition of a monad, but is invoked on pattern-match - -- failure in a @do@ expression. - -- - -- As part of the MonadFail proposal (MFP), this function is moved - -- to its own class 'Control.Monad.MonadFail' (see "Control.Monad.Fail" for - -- more details). The definition here will be removed in a future - -- release. - fail :: String -> m a - fail s = errorWithoutStackTrace s - {- Note [Recursive bindings for Applicative/Monad] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -855,8 +844,6 @@ instance Monad Maybe where (>>) = (*>) - fail _ = Nothing - -- ----------------------------------------------------------------------------- -- The Alternative class definition @@ -984,8 +971,6 @@ instance Monad [] where xs >>= f = [y | x <- xs, y <- f x] {-# INLINE (>>) #-} (>>) = (*>) - {-# INLINE fail #-} - fail _ = [] -- | @since 2.01 instance Alternative [] where @@ -1365,7 +1350,6 @@ instance Monad IO where {-# INLINE (>>=) #-} (>>) = (*>) (>>=) = bindIO - fail s = failIO s -- | @since 4.9.0.0 instance Alternative IO where diff --git a/libraries/base/GHC/Conc/Sync.hs b/libraries/base/GHC/Conc/Sync.hs index 7038b0db04..5c3e63a8e3 100644 --- a/libraries/base/GHC/Conc/Sync.hs +++ b/libraries/base/GHC/Conc/Sync.hs @@ -367,7 +367,7 @@ to avoid contention with other processes in the machine. -} setNumCapabilities :: Int -> IO () setNumCapabilities i - | i <= 0 = fail $ "setNumCapabilities: Capability count ("++show i++") must be positive" + | i <= 0 = failIO $ "setNumCapabilities: Capability count ("++show i++") must be positive" | otherwise = c_setNumCapabilities (fromIntegral i) foreign import ccall safe "setNumCapabilities" diff --git a/libraries/base/GHC/TopHandler.hs b/libraries/base/GHC/TopHandler.hs index d98836988a..bb358a337f 100644 --- a/libraries/base/GHC/TopHandler.hs +++ b/libraries/base/GHC/TopHandler.hs @@ -241,7 +241,7 @@ safeExit = exitHelper useSafeExit fastExit = exitHelper useFastExit unreachable :: IO a -unreachable = fail "If you can read this, shutdownHaskellAndExit did not exit." +unreachable = failIO "If you can read this, shutdownHaskellAndExit did not exit." exitHelper :: CInt -> Int -> IO a #if defined(mingw32_HOST_OS) diff --git a/libraries/base/Prelude.hs b/libraries/base/Prelude.hs index 15e392f271..f7b2fd9c2e 100644 --- a/libraries/base/Prelude.hs +++ b/libraries/base/Prelude.hs @@ -73,7 +73,8 @@ module Prelude ( -- ** Monads and functors Functor(fmap, (<$)), (<$>), Applicative(pure, (<*>), (*>), (<*)), - Monad((>>=), (>>), return, fail), + Monad((>>=), (>>), return), + MonadFail(fail), mapM_, sequence_, (=<<), -- ** Folds and traversals diff --git a/libraries/base/System/IO.hs b/libraries/base/System/IO.hs index 1fc39bed25..4549c8f12e 100644 --- a/libraries/base/System/IO.hs +++ b/libraries/base/System/IO.hs @@ -236,7 +236,7 @@ import System.Posix.Types import GHC.Base import GHC.List -#ifndef mingw32_HOST_OS +#if !defined(mingw32_HOST_OS) import GHC.IORef #endif import GHC.Num @@ -485,7 +485,7 @@ openTempFile' :: String -> FilePath -> String -> Bool -> CMode -> IO (FilePath, Handle) openTempFile' loc tmp_dir template binary mode | pathSeparator template - = fail $ "openTempFile': Template string must not contain path separator characters: "++template + = failIO $ "openTempFile': Template string must not contain path separator characters: "++template | otherwise = findTempName where -- We split off the last extension, so we can use .foo.ext files diff --git a/libraries/base/Text/ParserCombinators/ReadP.hs b/libraries/base/Text/ParserCombinators/ReadP.hs index e28f32d53a..e6dcab55e0 100644 --- a/libraries/base/Text/ParserCombinators/ReadP.hs +++ b/libraries/base/Text/ParserCombinators/ReadP.hs @@ -120,8 +120,6 @@ instance Monad P where (Result x p) >>= k = k x <|> (p >>= k) (Final (r:|rs)) >>= k = final [ys' | (x,s) <- (r:rs), ys' <- run (k x) s] - fail _ = Fail - -- | @since 4.9.0.0 instance MonadFail P where fail _ = Fail @@ -177,7 +175,6 @@ instance Applicative ReadP where -- | @since 2.01 instance Monad ReadP where - fail _ = R (\_ -> Fail) R m >>= f = R (\k -> m (\a -> let R m' = f a in m' k)) -- | @since 4.9.0.0 diff --git a/libraries/base/Text/ParserCombinators/ReadPrec.hs b/libraries/base/Text/ParserCombinators/ReadPrec.hs index 2b30fe08ac..df7704549a 100644 --- a/libraries/base/Text/ParserCombinators/ReadPrec.hs +++ b/libraries/base/Text/ParserCombinators/ReadPrec.hs @@ -85,7 +85,6 @@ instance Applicative ReadPrec where -- | @since 2.01 instance Monad ReadPrec where - fail s = P (\_ -> fail s) P f >>= k = P (\n -> do a <- f n; let P f' = k a in f' n) -- | @since 4.9.0.0 diff --git a/libraries/base/base.cabal b/libraries/base/base.cabal index 630ff91d11..57ac829b66 100644 --- a/libraries/base/base.cabal +++ b/libraries/base/base.cabal @@ -1,6 +1,6 @@ -cabal-version: 2.1 +cabal-version: 2.2 name: base -version: 4.12.0.0 +version: 4.13.0.0 -- NOTE: Don't forget to update ./changelog.md license: BSD-3-Clause diff --git a/libraries/hpc b/libraries/hpc -Subproject 75f898badf40cddba7b3bcf149648e49095a52f +Subproject 7673420558e2a54affe530911d555cc78577ad8 diff --git a/testsuite/tests/ado/ado004.stderr b/testsuite/tests/ado/ado004.stderr index 86066d3e31..480f9200f2 100644 --- a/testsuite/tests/ado/ado004.stderr +++ b/testsuite/tests/ado/ado004.stderr @@ -42,5 +42,5 @@ TYPE SIGNATURES (Monad m, Num (m a)) => (m a -> m (m a)) -> p -> m a Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/backpack/cabal/T16219/backpack-issue.cabal b/testsuite/tests/backpack/cabal/T16219/backpack-issue.cabal index 4c3f673750..b9752674bd 100644 --- a/testsuite/tests/backpack/cabal/T16219/backpack-issue.cabal +++ b/testsuite/tests/backpack/cabal/T16219/backpack-issue.cabal @@ -18,19 +18,19 @@ cabal-version: >=2 library library-a signatures: A.Sig exposed-modules: B - build-depends: base >=4.12 && <4.13 + build-depends: base == 4.13.* hs-source-dirs: library-a default-language: Haskell2010 library library-a-impl exposed-modules: A - build-depends: base >=4.12 && <4.13 + build-depends: base == 4.13.* hs-source-dirs: library-a-impl default-language: Haskell2010 library library-b exposed-modules: C - build-depends: base >=4.12 && <4.13 + build-depends: base == 4.13.* , library-a hs-source-dirs: library-b default-language: Haskell2010 @@ -40,7 +40,7 @@ library mixins: library-a requires (A.Sig as A) , library-b requires (A.Sig as A) reexported-modules: A, B, C - build-depends: base >=4.12 && <4.13 + build-depends: base == 4.13.* , library-a , library-a-impl , library-b diff --git a/testsuite/tests/backpack/should_compile/bkp16.stderr b/testsuite/tests/backpack/should_compile/bkp16.stderr index 4a5f2d04d2..4017e4700e 100644 --- a/testsuite/tests/backpack/should_compile/bkp16.stderr +++ b/testsuite/tests/backpack/should_compile/bkp16.stderr @@ -2,7 +2,7 @@ [1 of 1] Compiling Int[sig] ( p/Int.hsig, nothing ) [2 of 2] Processing q Instantiating q - [1 of 1] Including p[Int=base-4.12.0.0:GHC.Exts] - Instantiating p[Int=base-4.12.0.0:GHC.Exts] + [1 of 1] Including p[Int=base-4.13.0.0:GHC.Exts] + Instantiating p[Int=base-4.13.0.0:GHC.Exts] [1 of 1] Including ghc-prim-0.5.3 [1 of 1] Compiling Int[sig] ( p/Int.hsig, bkp16.out/p/p-97PZnzqiJmd2hTwUNGdjod/Int.o ) diff --git a/testsuite/tests/backpack/should_fail/bkpfail16.stderr b/testsuite/tests/backpack/should_fail/bkpfail16.stderr index c893ebae35..b3bea76954 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail16.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail16.stderr @@ -2,8 +2,8 @@ [1 of 1] Compiling ShouldFail[sig] ( p/ShouldFail.hsig, nothing ) [2 of 2] Processing q Instantiating q - [1 of 1] Including p[ShouldFail=base-4.12.0.0:Data.Bool] - Instantiating p[ShouldFail=base-4.12.0.0:Data.Bool] + [1 of 1] Including p[ShouldFail=base-4.13.0.0:Data.Bool] + Instantiating p[ShouldFail=base-4.13.0.0:Data.Bool] [1 of 1] Compiling ShouldFail[sig] ( p/ShouldFail.hsig, bkpfail16.out/p/p-1OqLaT7dAn947wScQQKCw5/ShouldFail.o ) bkpfail16.out/p/p-1OqLaT7dAn947wScQQKCw5/../ShouldFail.hi:1:1: error: diff --git a/testsuite/tests/backpack/should_fail/bkpfail17.stderr b/testsuite/tests/backpack/should_fail/bkpfail17.stderr index 02ee990c90..7bd5c5778d 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail17.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail17.stderr @@ -2,8 +2,8 @@ [1 of 1] Compiling ShouldFail[sig] ( p/ShouldFail.hsig, nothing ) [2 of 2] Processing q Instantiating q - [1 of 1] Including p[ShouldFail=base-4.12.0.0:Prelude] - Instantiating p[ShouldFail=base-4.12.0.0:Prelude] + [1 of 1] Including p[ShouldFail=base-4.13.0.0:Prelude] + Instantiating p[ShouldFail=base-4.13.0.0:Prelude] [1 of 1] Compiling ShouldFail[sig] ( p/ShouldFail.hsig, bkpfail17.out/p/p-2W6J7O3LvroH97zGxbPEGF/ShouldFail.o ) <no location info>: error: diff --git a/testsuite/tests/backpack/should_fail/bkpfail19.stderr b/testsuite/tests/backpack/should_fail/bkpfail19.stderr index 03fdcd7d16..a66eca5e60 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail19.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail19.stderr @@ -2,8 +2,8 @@ [1 of 1] Compiling ShouldFail[sig] ( p/ShouldFail.hsig, nothing ) [2 of 2] Processing q Instantiating q - [1 of 1] Including p[ShouldFail=base-4.12.0.0:Data.STRef] - Instantiating p[ShouldFail=base-4.12.0.0:Data.STRef] + [1 of 1] Including p[ShouldFail=base-4.13.0.0:Data.STRef] + Instantiating p[ShouldFail=base-4.13.0.0:Data.STRef] [1 of 1] Compiling ShouldFail[sig] ( p/ShouldFail.hsig, bkpfail19.out/p/p-CfyUIAu1JTRCDuXEyGszXN/ShouldFail.o ) <no location info>: error: diff --git a/testsuite/tests/deSugar/should_run/dsrun010.hs b/testsuite/tests/deSugar/should_run/dsrun010.hs index 1d4fc485e0..c11fa2a765 100644 --- a/testsuite/tests/deSugar/should_run/dsrun010.hs +++ b/testsuite/tests/deSugar/should_run/dsrun010.hs @@ -2,13 +2,11 @@ -- is reflected by calling the monadic 'fail', not by a -- runtime exception -{-# LANGUAGE NoMonadFailDesugaring #-} -{-# OPTIONS -Wno-missing-monadfail-instances #-} - import Control.Monad +import Control.Monad.Fail import Data.Maybe -test :: (MonadPlus m) => [a] -> m Bool +test :: (MonadPlus m, MonadFail m) => [a] -> m Bool test xs = do (_:_) <- return xs diff --git a/testsuite/tests/dependent/should_compile/T14729.stderr b/testsuite/tests/dependent/should_compile/T14729.stderr index dcf441ce8a..f1294d3650 100644 --- a/testsuite/tests/dependent/should_compile/T14729.stderr +++ b/testsuite/tests/dependent/should_compile/T14729.stderr @@ -11,5 +11,5 @@ COERCION AXIOMS FAMILY INSTANCES type instance F Int = Bool -- Defined at T14729.hs:10:15 Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/dependent/should_compile/T15743.stderr b/testsuite/tests/dependent/should_compile/T15743.stderr index ea84b953fb..f9a1c248f8 100644 --- a/testsuite/tests/dependent/should_compile/T15743.stderr +++ b/testsuite/tests/dependent/should_compile/T15743.stderr @@ -3,5 +3,5 @@ TYPE CONSTRUCTORS forall {k1} k2 (k3 :: k2). Proxy k3 -> k1 -> k2 -> * roles nominal nominal nominal phantom phantom phantom Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/dependent/should_compile/T15743e.stderr b/testsuite/tests/dependent/should_compile/T15743e.stderr index dcfdd2e831..fc80d17949 100644 --- a/testsuite/tests/dependent/should_compile/T15743e.stderr +++ b/testsuite/tests/dependent/should_compile/T15743e.stderr @@ -52,5 +52,5 @@ DATA CONSTRUCTORS (d :: Proxy k5) (e :: Proxy k7). f c -> T k8 a b f c d e Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/determinism/determ017/A.hs b/testsuite/tests/determinism/determ017/A.hs index 5e3c3d0809..082c9380de 100644 --- a/testsuite/tests/determinism/determ017/A.hs +++ b/testsuite/tests/determinism/determ017/A.hs @@ -20,7 +20,7 @@ -- | Module "Trampoline" defines the pipe computations and their basic building blocks. {-# LANGUAGE ScopedTypeVariables, Rank2Types, MultiParamTypeClasses, - TypeFamilies, KindSignatures, FlexibleContexts, NoMonadFailDesugaring, + TypeFamilies, KindSignatures, FlexibleContexts, FlexibleInstances, OverlappingInstances, UndecidableInstances #-} @@ -81,6 +81,9 @@ instance Monad Identity where return a = Identity a m >>= k = k (runIdentity m) +instance MonadFail Identity where + fail = error "Identity(fail)" + newtype Trampoline m s r = Trampoline {bounce :: m (TrampolineState m s r)} data TrampolineState m s r = Done r | Suspend! (s (Trampoline m s r)) @@ -97,6 +100,9 @@ instance (Monad m, Functor s) => Monad (Trampoline m s) where where apply f (Done x) = bounce (f x) apply f (Suspend s) = return (Suspend (fmap (>>= f) s)) +instance (MonadFail m, Functor s) => MonadFail (Trampoline m s) where + fail = error "Trampoline(fail)" + data Yield x y = Yield! x y instance Functor (Yield x) where fmap f (Yield x y) = trace "fmap yield" $ Yield x (f y) diff --git a/testsuite/tests/determinism/determ021/determ021.stdout b/testsuite/tests/determinism/determ021/determ021.stdout index d0a002bc9a..a39bc192bb 100644 --- a/testsuite/tests/determinism/determ021/determ021.stdout +++ b/testsuite/tests/determinism/determ021/determ021.stdout @@ -5,7 +5,7 @@ TYPE SIGNATURES (Applicative f, Num t, Num b) => (t -> f b) -> f b Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] [1 of 1] Compiling A ( A.hs, A.o ) TYPE SIGNATURES @@ -14,5 +14,5 @@ TYPE SIGNATURES (Applicative f, Num t, Num b) => (t -> f b) -> f b Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/driver/json2.stderr b/testsuite/tests/driver/json2.stderr index d5e50bea25..b419cff30c 100644 --- a/testsuite/tests/driver/json2.stderr +++ b/testsuite/tests/driver/json2.stderr @@ -1 +1 @@ -{"span": null,"doc": "TYPE SIGNATURES\n foo :: forall a. a -> a\nDependent modules: []\nDependent packages: [base-4.12.0.0, ghc-prim-0.5.3,\n integer-gmp-1.0.2.0]","severity": "SevOutput","reason": null} +{"span": null,"doc": "TYPE SIGNATURES\n foo :: forall a. a -> a\nDependent modules: []\nDependent packages: [base-4.13.0.0, ghc-prim-0.5.3,\n integer-gmp-1.0.2.0]","severity": "SevOutput","reason": null} diff --git a/testsuite/tests/ghci/scripts/T4175.stdout b/testsuite/tests/ghci/scripts/T4175.stdout index de4e28c46f..5e4560a868 100644 --- a/testsuite/tests/ghci/scripts/T4175.stdout +++ b/testsuite/tests/ghci/scripts/T4175.stdout @@ -39,6 +39,7 @@ instance Semigroup a => Semigroup (Maybe a) -- Defined in ‘GHC.Base’ instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’ instance Read a => Read (Maybe a) -- Defined in ‘GHC.Read’ +instance MonadFail Maybe -- Defined in ‘Control.Monad.Fail’ instance Foldable Maybe -- Defined in ‘Data.Foldable’ instance Traversable Maybe -- Defined in ‘Data.Traversable’ type instance A (Maybe a) a = a -- Defined at T4175.hs:9:15 diff --git a/testsuite/tests/ghci/scripts/ghci008.stdout b/testsuite/tests/ghci/scripts/ghci008.stdout index 6c105eb731..abed6d21f3 100644 --- a/testsuite/tests/ghci/scripts/ghci008.stdout +++ b/testsuite/tests/ghci/scripts/ghci008.stdout @@ -35,5 +35,5 @@ class (RealFrac a, Floating a) => RealFloat a where -- Defined in ‘GHC.Float’ instance RealFloat Float -- Defined in ‘GHC.Float’ instance RealFloat Double -- Defined in ‘GHC.Float’ -base-4.12.0.0:Data.OldList.isPrefixOf :: Eq a => [a] -> [a] -> Bool - -- Defined in ‘base-4.12.0.0:Data.OldList’ +base-4.13.0.0:Data.OldList.isPrefixOf :: Eq a => [a] -> [a] -> Bool + -- Defined in ‘base-4.13.0.0:Data.OldList’ diff --git a/testsuite/tests/ghci/scripts/ghci011.stdout b/testsuite/tests/ghci/scripts/ghci011.stdout index 7bd58dcc24..112dde7811 100644 --- a/testsuite/tests/ghci/scripts/ghci011.stdout +++ b/testsuite/tests/ghci/scripts/ghci011.stdout @@ -8,6 +8,7 @@ instance Ord a => Ord [a] -- Defined in ‘GHC.Classes’ instance Semigroup [a] -- Defined in ‘GHC.Base’ instance Show a => Show [a] -- Defined in ‘GHC.Show’ instance Read a => Read [a] -- Defined in ‘GHC.Read’ +instance MonadFail [] -- Defined in ‘Control.Monad.Fail’ instance Foldable [] -- Defined in ‘Data.Foldable’ instance Traversable [] -- Defined in ‘Data.Traversable’ data () = () -- Defined in ‘GHC.Tuple’ diff --git a/testsuite/tests/ghci/scripts/ghci025.stdout b/testsuite/tests/ghci/scripts/ghci025.stdout index 75933a9196..9c862d340c 100644 --- a/testsuite/tests/ghci/scripts/ghci025.stdout +++ b/testsuite/tests/ghci/scripts/ghci025.stdout @@ -18,7 +18,6 @@ mzero :: MonadPlus m => m a -- imported via Control.Monad, Prelude (>>) :: Monad m => m a -> m b -> m b (>>=) :: Monad m => m a -> (a -> m b) -> m b -fail :: Monad m => GHC.Base.String -> m a return :: Monad m => a -> m a -- imported via Control.Monad, Prelude, T class GHC.Base.Applicative m => Monad (m :: * -> *) diff --git a/testsuite/tests/indexed-types/should_compile/T15711.stderr b/testsuite/tests/indexed-types/should_compile/T15711.stderr index 7101dce027..db5181c8df 100644 --- a/testsuite/tests/indexed-types/should_compile/T15711.stderr +++ b/testsuite/tests/indexed-types/should_compile/T15711.stderr @@ -3,5 +3,5 @@ TYPE CONSTRUCTORS associated type family F{2} :: forall a. Maybe a -> * roles nominal nominal Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/indexed-types/should_compile/T15852.stderr b/testsuite/tests/indexed-types/should_compile/T15852.stderr index 9024739ecb..fbc3cb9f9f 100644 --- a/testsuite/tests/indexed-types/should_compile/T15852.stderr +++ b/testsuite/tests/indexed-types/should_compile/T15852.stderr @@ -9,5 +9,5 @@ FAMILY INSTANCES data instance forall k1 k2 (j :: k1) (c :: k2). DF (Proxy c) -- Defined at T15852.hs:10:15 Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/indexed-types/should_compile/T3017.stderr b/testsuite/tests/indexed-types/should_compile/T3017.stderr index 8b5f8688dc..c83c5e3563 100644 --- a/testsuite/tests/indexed-types/should_compile/T3017.stderr +++ b/testsuite/tests/indexed-types/should_compile/T3017.stderr @@ -18,5 +18,5 @@ CLASS INSTANCES FAMILY INSTANCES type instance Elem (ListColl a) = a -- Defined at T3017.hs:13:9 Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/monadfail/MonadFailErrors.hs b/testsuite/tests/monadfail/MonadFailErrors.hs index f9db31e5a0..008a0b2c16 100644 --- a/testsuite/tests/monadfail/MonadFailErrors.hs +++ b/testsuite/tests/monadfail/MonadFailErrors.hs @@ -1,8 +1,6 @@ -- Test purpose: -- Break properly if MonadFail is live -{-# LANGUAGE MonadFailDesugaring #-} - module MonadFailWarnings where import Control.Monad.Fail diff --git a/testsuite/tests/monadfail/MonadFailErrors.stderr b/testsuite/tests/monadfail/MonadFailErrors.stderr index 27fc3c3cf5..285e6fb4e0 100644 --- a/testsuite/tests/monadfail/MonadFailErrors.stderr +++ b/testsuite/tests/monadfail/MonadFailErrors.stderr @@ -1,12 +1,12 @@ -MonadFailErrors.hs:16:5: error: +MonadFailErrors.hs:14:5: error: • Could not deduce (MonadFail m) arising from a do statement with the failable pattern ‘Just x’ from the context: Monad m bound by the type signature for: general :: forall (m :: * -> *) a. Monad m => m a - at MonadFailErrors.hs:14:1-25 + at MonadFailErrors.hs:12:1-25 Possible fix: add (MonadFail m) to the context of the type signature for: @@ -20,7 +20,7 @@ MonadFailErrors.hs:16:5: error: = do Just x <- undefined undefined -MonadFailErrors.hs:30:5: error: +MonadFailErrors.hs:28:5: error: • No instance for (MonadFail Identity) arising from a do statement with the failable pattern ‘Just x’ @@ -33,7 +33,7 @@ MonadFailErrors.hs:30:5: error: = do Just x <- undefined undefined -MonadFailErrors.hs:51:5: error: +MonadFailErrors.hs:49:5: error: • No instance for (MonadFail ((->) r)) arising from a do statement with the failable pattern ‘Just x’ diff --git a/testsuite/tests/monadfail/MonadFailWarnings.hs b/testsuite/tests/monadfail/MonadFailWarnings.hs deleted file mode 100644 index 7e3d7fc428..0000000000 --- a/testsuite/tests/monadfail/MonadFailWarnings.hs +++ /dev/null @@ -1,107 +0,0 @@ --- Test purpose: --- Ensure that MonadFail warnings are issued correctly if the warning flag --- is enabled -{-# LANGUAGE NoMonadFailDesugaring #-} -{-# OPTIONS_GHC -Wmissing-monadfail-instances -Wno-error=compat #-} - -module MonadFailWarnings where - -import Control.Monad.Fail -import Control.Monad.ST -import Data.Functor.Identity - - - --- should warn, because the do-block gets a general Monad constraint, --- but should have MonadFail -general :: Monad m => m a -general = do - Just x <- undefined - undefined - - - --- should NOT warn, because the constraint is correct -general' :: MonadFail m => m a -general' = do - Just x <- undefined - undefined - - - --- should warn, because Identity isn't MonadFail -identity :: Identity a -identity = do - Just x <- undefined - undefined - - - --- should NOT warn, because IO is MonadFail -io :: IO a -io = do - Just x <- undefined - undefined - - - --- should warn, because (ST s) is not MonadFail -st :: ST s a -st = do - Just x <- undefined - undefined - - - --- should warn, because (r ->) is not MonadFail -reader :: r -> a -reader = do - Just x <- undefined - undefined - - - --- should NOT warn, because matching against newtype -newtype Newtype a = Newtype a -newtypeMatch :: Identity a -newtypeMatch = do - Newtype x <- undefined - undefined - - - --- should NOT warn, because Data has only one constructor -data Data a = Data a -singleConMatch :: Identity a -singleConMatch = do - Data x <- undefined - undefined - - - --- should NOT warn, because Maybe' has a MonadFail instance -data Maybe' a = Nothing' | Just' a -instance Functor Maybe' where fmap = undefined -instance Applicative Maybe' where pure = undefined; (<*>) = undefined -instance Monad Maybe' where (>>=) = undefined -instance MonadFail Maybe' where fail = undefined -customFailable :: Maybe' a -customFailable = do - Just x <- undefined - undefined - - --- should NOT warn, because patterns always match -wildcardx, explicitlyIrrefutable, wildcard_, tuple :: Monad m => m a -wildcardx = do - x <- undefined - undefined -explicitlyIrrefutable = do - ~(x:y) <- undefined - undefined -wildcard_ = do - _ <- undefined - undefined -tuple = do - (a,b) <- undefined - undefined diff --git a/testsuite/tests/monadfail/MonadFailWarnings.stderr b/testsuite/tests/monadfail/MonadFailWarnings.stderr deleted file mode 100644 index 7a341fc816..0000000000 --- a/testsuite/tests/monadfail/MonadFailWarnings.stderr +++ /dev/null @@ -1,47 +0,0 @@ - -MonadFailWarnings.hs:19:5: warning: [-Wmissing-monadfail-instances (in -Wcompat)] - • Could not deduce (MonadFail m) - arising from the failable pattern ‘Just x’ - (this will become an error in a future GHC release) - from the context: Monad m - bound by the type signature for: - general :: forall (m :: * -> *) a. Monad m => m a - at MonadFailWarnings.hs:17:1-25 - Possible fix: - add (MonadFail m) to the context of - the type signature for: - general :: forall (m :: * -> *) a. Monad m => m a - • In a stmt of a 'do' block: Just x <- undefined - In the expression: - do Just x <- undefined - undefined - In an equation for ‘general’: - general - = do Just x <- undefined - undefined - -MonadFailWarnings.hs:35:5: warning: [-Wmissing-monadfail-instances (in -Wcompat)] - • No instance for (MonadFail Identity) - arising from the failable pattern ‘Just x’ - (this will become an error in a future GHC release) - • In a stmt of a 'do' block: Just x <- undefined - In the expression: - do Just x <- undefined - undefined - In an equation for ‘identity’: - identity - = do Just x <- undefined - undefined - -MonadFailWarnings.hs:59:5: warning: [-Wmissing-monadfail-instances (in -Wcompat)] - • No instance for (MonadFail ((->) r)) - arising from the failable pattern ‘Just x’ - (this will become an error in a future GHC release) - • In a stmt of a 'do' block: Just x <- undefined - In the expression: - do Just x <- undefined - undefined - In an equation for ‘reader’: - reader - = do Just x <- undefined - undefined diff --git a/testsuite/tests/monadfail/MonadFailWarningsDisabled.hs b/testsuite/tests/monadfail/MonadFailWarningsDisabled.hs deleted file mode 100644 index 858a212b45..0000000000 --- a/testsuite/tests/monadfail/MonadFailWarningsDisabled.hs +++ /dev/null @@ -1,100 +0,0 @@ --- Test purpose: --- Make sure that not enabling MonadFail warnings makes code compile just --- as it did in < 8.0 - --- NOTE: starting w/ GHC 8.6 sugaring is turned on by default; so we have --- to disable to keep supporting this test-case --- -{-# LANGUAGE NoMonadFailDesugaring #-} -{-# OPTIONS -Wno-missing-monadfail-instances #-} - -module MonadFailWarnings where - -import Control.Monad.Fail -import Control.Monad.ST -import Data.Functor.Identity - - - -general :: Monad m => m a -general = do - Just x <- undefined - undefined - - - -general' :: MonadFail m => m a -general' = do - Just x <- undefined - undefined - - - -identity :: Identity a -identity = do - Just x <- undefined - undefined - - - -io :: IO a -io = do - Just x <- undefined - undefined - - - -st :: ST s a -st = do - Just x <- undefined - undefined - - - -reader :: r -> a -reader = do - Just x <- undefined - undefined - - - -newtype Newtype a = Newtype a -newtypeMatch :: Identity a -newtypeMatch = do - Newtype x <- undefined - undefined - - - -data Data a = Data a -singleConMatch :: Identity a -singleConMatch = do - Data x <- undefined - undefined - - - -data Maybe' a = Nothing' | Just' a -instance Functor Maybe' where fmap = undefined -instance Applicative Maybe' where pure = undefined; (<*>) = undefined -instance Monad Maybe' where (>>=) = undefined -instance MonadFail Maybe' where fail = undefined -customFailable :: Maybe' a -customFailable = do - Just x <- undefined - undefined - - -wildcardx, explicitlyIrrefutable, wildcard_, tuple :: Monad m => m a -wildcardx = do - x <- undefined - undefined -explicitlyIrrefutable = do - ~(x:y) <- undefined - undefined -wildcard_ = do - _ <- undefined - undefined -tuple = do - (a,b) <- undefined - undefined diff --git a/testsuite/tests/monadfail/MonadFailWarningsWithRebindableSyntax.hs b/testsuite/tests/monadfail/MonadFailWarningsWithRebindableSyntax.hs deleted file mode 100644 index b369fc019f..0000000000 --- a/testsuite/tests/monadfail/MonadFailWarningsWithRebindableSyntax.hs +++ /dev/null @@ -1,14 +0,0 @@ --- Test purpose: --- RebindableSyntax does not play that well with MonadFail, so here we ensure --- that when both settings are enabled we get the proper warning. - -{-# OPTIONS_GHC -Wmissing-monadfail-instances -Wno-error=compat #-} -{-# LANGUAGE RebindableSyntax #-} - -module MonadFailWarningsWithRebindableSyntax where - -import Prelude - -test1 f g = do - Just x <- f - g diff --git a/testsuite/tests/monadfail/MonadFailWarningsWithRebindableSyntax.stderr b/testsuite/tests/monadfail/MonadFailWarningsWithRebindableSyntax.stderr deleted file mode 100644 index 7b6cd1ba6d..0000000000 --- a/testsuite/tests/monadfail/MonadFailWarningsWithRebindableSyntax.stderr +++ /dev/null @@ -1,5 +0,0 @@ - -MonadFailWarningsWithRebindableSyntax.hs:13:5: warning: [-Wmissing-monadfail-instances (in -Wcompat)] - The failable pattern ‘Just x’ - is used together with -XRebindableSyntax. If this is intentional, - compile with -Wno-missing-monadfail-instances. diff --git a/testsuite/tests/monadfail/all.T b/testsuite/tests/monadfail/all.T index 32eddb9e98..8fde0296dc 100644 --- a/testsuite/tests/monadfail/all.T +++ b/testsuite/tests/monadfail/all.T @@ -1,4 +1 @@ -test('MonadFailWarnings', normal, compile, ['']) test('MonadFailErrors', normal, compile_fail, ['']) -test('MonadFailWarningsDisabled', normal, compile, ['']) -test('MonadFailWarningsWithRebindableSyntax', normal, compile, ['']) diff --git a/testsuite/tests/partial-sigs/should_compile/ADT.stderr b/testsuite/tests/partial-sigs/should_compile/ADT.stderr index 421a03ff00..4b88c5bee6 100644 --- a/testsuite/tests/partial-sigs/should_compile/ADT.stderr +++ b/testsuite/tests/partial-sigs/should_compile/ADT.stderr @@ -5,5 +5,5 @@ TYPE CONSTRUCTORS DATA CONSTRUCTORS Foo :: forall x y z. x -> y -> z -> Foo x y z Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/AddAndOr1.stderr b/testsuite/tests/partial-sigs/should_compile/AddAndOr1.stderr index cc5ab0a567..da3c905687 100644 --- a/testsuite/tests/partial-sigs/should_compile/AddAndOr1.stderr +++ b/testsuite/tests/partial-sigs/should_compile/AddAndOr1.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES addAndOr1 :: (Int, Bool) -> (Bool, Int) -> (Int, Bool) Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/AddAndOr2.stderr b/testsuite/tests/partial-sigs/should_compile/AddAndOr2.stderr index cf4989b53b..d4e6be7baa 100644 --- a/testsuite/tests/partial-sigs/should_compile/AddAndOr2.stderr +++ b/testsuite/tests/partial-sigs/should_compile/AddAndOr2.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES addAndOr2 :: (Int, Bool) -> (Bool, Int) -> (Int, Bool) Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/AddAndOr3.stderr b/testsuite/tests/partial-sigs/should_compile/AddAndOr3.stderr index d7a164b318..d8a7276ca2 100644 --- a/testsuite/tests/partial-sigs/should_compile/AddAndOr3.stderr +++ b/testsuite/tests/partial-sigs/should_compile/AddAndOr3.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES addAndOr3 :: (Int, Bool) -> (Bool, Int) -> (Int, Bool) Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/AddAndOr4.stderr b/testsuite/tests/partial-sigs/should_compile/AddAndOr4.stderr index 30b1744463..4e36933ea5 100644 --- a/testsuite/tests/partial-sigs/should_compile/AddAndOr4.stderr +++ b/testsuite/tests/partial-sigs/should_compile/AddAndOr4.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES addAndOr4 :: (Int, Bool) -> (Bool, Int) -> (Int, Bool) Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/AddAndOr5.stderr b/testsuite/tests/partial-sigs/should_compile/AddAndOr5.stderr index 97e4ba2eca..28d1142b5c 100644 --- a/testsuite/tests/partial-sigs/should_compile/AddAndOr5.stderr +++ b/testsuite/tests/partial-sigs/should_compile/AddAndOr5.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES addAndOr5 :: (Int, Bool) -> (Bool, Int) -> (Int, Bool) Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/AddAndOr6.stderr b/testsuite/tests/partial-sigs/should_compile/AddAndOr6.stderr index 1cb89650b8..b126c30810 100644 --- a/testsuite/tests/partial-sigs/should_compile/AddAndOr6.stderr +++ b/testsuite/tests/partial-sigs/should_compile/AddAndOr6.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES addAndOr6 :: (Int, Bool) -> (Bool, Int) -> (Int, Bool) Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/BoolToBool.stderr b/testsuite/tests/partial-sigs/should_compile/BoolToBool.stderr index 3af6ead3fd..1e425b4a12 100644 --- a/testsuite/tests/partial-sigs/should_compile/BoolToBool.stderr +++ b/testsuite/tests/partial-sigs/should_compile/BoolToBool.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES bar :: Bool -> Bool Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/DataFamilyInstanceLHS.stderr b/testsuite/tests/partial-sigs/should_compile/DataFamilyInstanceLHS.stderr index f17860f975..a633bf7ef4 100644 --- a/testsuite/tests/partial-sigs/should_compile/DataFamilyInstanceLHS.stderr +++ b/testsuite/tests/partial-sigs/should_compile/DataFamilyInstanceLHS.stderr @@ -15,5 +15,5 @@ DATA CONSTRUCTORS FAMILY INSTANCES data instance Sing _ -- Defined at DataFamilyInstanceLHS.hs:8:15 Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/Defaulting1MROn.stderr b/testsuite/tests/partial-sigs/should_compile/Defaulting1MROn.stderr index 34107ee791..6d1a40462a 100644 --- a/testsuite/tests/partial-sigs/should_compile/Defaulting1MROn.stderr +++ b/testsuite/tests/partial-sigs/should_compile/Defaulting1MROn.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES alpha :: Integer Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/Defaulting2MROff.stderr b/testsuite/tests/partial-sigs/should_compile/Defaulting2MROff.stderr index beb850c5fe..0fd7f5c64b 100644 --- a/testsuite/tests/partial-sigs/should_compile/Defaulting2MROff.stderr +++ b/testsuite/tests/partial-sigs/should_compile/Defaulting2MROff.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES bravo :: forall _. Num _ => _ Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/Defaulting2MROn.stderr b/testsuite/tests/partial-sigs/should_compile/Defaulting2MROn.stderr index beb850c5fe..0fd7f5c64b 100644 --- a/testsuite/tests/partial-sigs/should_compile/Defaulting2MROn.stderr +++ b/testsuite/tests/partial-sigs/should_compile/Defaulting2MROn.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES bravo :: forall _. Num _ => _ Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/Either.stderr b/testsuite/tests/partial-sigs/should_compile/Either.stderr index 9769909910..aa774f73b9 100644 --- a/testsuite/tests/partial-sigs/should_compile/Either.stderr +++ b/testsuite/tests/partial-sigs/should_compile/Either.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES barry :: forall _. _ -> (Either [Char] _, Either [Char] _) Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/EqualityConstraint.stderr b/testsuite/tests/partial-sigs/should_compile/EqualityConstraint.stderr index ea6cf34487..f2e1bd6952 100644 --- a/testsuite/tests/partial-sigs/should_compile/EqualityConstraint.stderr +++ b/testsuite/tests/partial-sigs/should_compile/EqualityConstraint.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES foo :: forall a. (a ~ Bool) => (a, Bool) Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/Every.stderr b/testsuite/tests/partial-sigs/should_compile/Every.stderr index bb09089aef..fc0d82103e 100644 --- a/testsuite/tests/partial-sigs/should_compile/Every.stderr +++ b/testsuite/tests/partial-sigs/should_compile/Every.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES every :: forall t. (t -> Bool) -> [t] -> Bool Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/EveryNamed.stderr b/testsuite/tests/partial-sigs/should_compile/EveryNamed.stderr index 59e2054c8c..0a13039a20 100644 --- a/testsuite/tests/partial-sigs/should_compile/EveryNamed.stderr +++ b/testsuite/tests/partial-sigs/should_compile/EveryNamed.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES every :: forall _. (_ -> Bool) -> [_] -> Bool Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/ExpressionSig.stderr b/testsuite/tests/partial-sigs/should_compile/ExpressionSig.stderr index 3af6ead3fd..1e425b4a12 100644 --- a/testsuite/tests/partial-sigs/should_compile/ExpressionSig.stderr +++ b/testsuite/tests/partial-sigs/should_compile/ExpressionSig.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES bar :: Bool -> Bool Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/ExpressionSigNamed.stderr b/testsuite/tests/partial-sigs/should_compile/ExpressionSigNamed.stderr index 3af6ead3fd..1e425b4a12 100644 --- a/testsuite/tests/partial-sigs/should_compile/ExpressionSigNamed.stderr +++ b/testsuite/tests/partial-sigs/should_compile/ExpressionSigNamed.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES bar :: Bool -> Bool Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/ExtraConstraints1.stderr b/testsuite/tests/partial-sigs/should_compile/ExtraConstraints1.stderr index 9fd86b8799..a3b033c5e4 100644 --- a/testsuite/tests/partial-sigs/should_compile/ExtraConstraints1.stderr +++ b/testsuite/tests/partial-sigs/should_compile/ExtraConstraints1.stderr @@ -5,5 +5,5 @@ TYPE SIGNATURES arbitCs4 :: forall a. (Eq a, Show a, Enum a) => a -> String arbitCs5 :: forall a. (Eq a, Enum a, Show a) => a -> String Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/ExtraConstraints2.stderr b/testsuite/tests/partial-sigs/should_compile/ExtraConstraints2.stderr index 830e504c59..bd7e97e1c6 100644 --- a/testsuite/tests/partial-sigs/should_compile/ExtraConstraints2.stderr +++ b/testsuite/tests/partial-sigs/should_compile/ExtraConstraints2.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES foo :: String Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/ExtraConstraints3.stderr b/testsuite/tests/partial-sigs/should_compile/ExtraConstraints3.stderr index 8bd167fdb7..533c8e5d29 100644 --- a/testsuite/tests/partial-sigs/should_compile/ExtraConstraints3.stderr +++ b/testsuite/tests/partial-sigs/should_compile/ExtraConstraints3.stderr @@ -66,7 +66,7 @@ TYPE SIGNATURES even :: forall a. Integral a => a -> Bool exp :: forall a. Floating a => a -> a exponent :: forall a. RealFloat a => a -> Int - fail :: forall (m :: * -> *) a. Monad m => String -> m a + fail :: forall (m :: * -> *) a. P.MonadFail m => String -> m a filter :: forall a. (a -> Bool) -> [a] -> [a] flip :: forall a b c. (a -> b -> c) -> b -> a -> c floatDigits :: forall a. RealFloat a => a -> Int @@ -228,5 +228,5 @@ TYPE SIGNATURES forall a b c d. (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d] || :: Bool -> Bool -> Bool Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/ExtraNumAMROff.stderr b/testsuite/tests/partial-sigs/should_compile/ExtraNumAMROff.stderr index 9cf9ef9788..1faceb256d 100644 --- a/testsuite/tests/partial-sigs/should_compile/ExtraNumAMROff.stderr +++ b/testsuite/tests/partial-sigs/should_compile/ExtraNumAMROff.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES foo :: forall a. Num a => a Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/ExtraNumAMROn.stderr b/testsuite/tests/partial-sigs/should_compile/ExtraNumAMROn.stderr index 9cf9ef9788..1faceb256d 100644 --- a/testsuite/tests/partial-sigs/should_compile/ExtraNumAMROn.stderr +++ b/testsuite/tests/partial-sigs/should_compile/ExtraNumAMROn.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES foo :: forall a. Num a => a Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/Forall1.stderr b/testsuite/tests/partial-sigs/should_compile/Forall1.stderr index aa01e67545..cfe44a0c38 100644 --- a/testsuite/tests/partial-sigs/should_compile/Forall1.stderr +++ b/testsuite/tests/partial-sigs/should_compile/Forall1.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES fall :: forall a. a -> a Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/GenNamed.stderr b/testsuite/tests/partial-sigs/should_compile/GenNamed.stderr index 3af6ead3fd..1e425b4a12 100644 --- a/testsuite/tests/partial-sigs/should_compile/GenNamed.stderr +++ b/testsuite/tests/partial-sigs/should_compile/GenNamed.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES bar :: Bool -> Bool Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/HigherRank1.stderr b/testsuite/tests/partial-sigs/should_compile/HigherRank1.stderr index 6bd36960ff..c7a8129f6e 100644 --- a/testsuite/tests/partial-sigs/should_compile/HigherRank1.stderr +++ b/testsuite/tests/partial-sigs/should_compile/HigherRank1.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES foo :: (forall a. [a] -> [a]) -> ([Bool], [Char]) Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/HigherRank2.stderr b/testsuite/tests/partial-sigs/should_compile/HigherRank2.stderr index 6bd36960ff..c7a8129f6e 100644 --- a/testsuite/tests/partial-sigs/should_compile/HigherRank2.stderr +++ b/testsuite/tests/partial-sigs/should_compile/HigherRank2.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES foo :: (forall a. [a] -> [a]) -> ([Bool], [Char]) Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/LocalDefinitionBug.stderr b/testsuite/tests/partial-sigs/should_compile/LocalDefinitionBug.stderr index 7106594a2e..ad0dfcffea 100644 --- a/testsuite/tests/partial-sigs/should_compile/LocalDefinitionBug.stderr +++ b/testsuite/tests/partial-sigs/should_compile/LocalDefinitionBug.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES monoLoc :: forall a. a -> ((a, String), (a, String)) Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/Meltdown.stderr b/testsuite/tests/partial-sigs/should_compile/Meltdown.stderr index 8e14ffd0af..74889e9400 100644 --- a/testsuite/tests/partial-sigs/should_compile/Meltdown.stderr +++ b/testsuite/tests/partial-sigs/should_compile/Meltdown.stderr @@ -12,5 +12,5 @@ CLASS INSTANCES -- Defined at Meltdown.hs:11:10 instance Monad (NukeMonad a b) -- Defined at Meltdown.hs:15:10 Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/MonoLocalBinds.stderr b/testsuite/tests/partial-sigs/should_compile/MonoLocalBinds.stderr index 7106594a2e..ad0dfcffea 100644 --- a/testsuite/tests/partial-sigs/should_compile/MonoLocalBinds.stderr +++ b/testsuite/tests/partial-sigs/should_compile/MonoLocalBinds.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES monoLoc :: forall a. a -> ((a, String), (a, String)) Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/NamedTyVar.stderr b/testsuite/tests/partial-sigs/should_compile/NamedTyVar.stderr index 8d6d3e5f01..9704c5c780 100644 --- a/testsuite/tests/partial-sigs/should_compile/NamedTyVar.stderr +++ b/testsuite/tests/partial-sigs/should_compile/NamedTyVar.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES foo :: forall b a. (a, b) -> (a, b) Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/NamedWildcardInDataFamilyInstanceLHS.stderr b/testsuite/tests/partial-sigs/should_compile/NamedWildcardInDataFamilyInstanceLHS.stderr index 0569228ac4..f71b0c4557 100644 --- a/testsuite/tests/partial-sigs/should_compile/NamedWildcardInDataFamilyInstanceLHS.stderr +++ b/testsuite/tests/partial-sigs/should_compile/NamedWildcardInDataFamilyInstanceLHS.stderr @@ -14,5 +14,5 @@ FAMILY INSTANCES data instance Sing _a -- Defined at NamedWildcardInDataFamilyInstanceLHS.hs:8:15 Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/NamedWildcardInTypeFamilyInstanceLHS.stderr b/testsuite/tests/partial-sigs/should_compile/NamedWildcardInTypeFamilyInstanceLHS.stderr index 690a1c689d..122c1fdc79 100644 --- a/testsuite/tests/partial-sigs/should_compile/NamedWildcardInTypeFamilyInstanceLHS.stderr +++ b/testsuite/tests/partial-sigs/should_compile/NamedWildcardInTypeFamilyInstanceLHS.stderr @@ -4,5 +4,5 @@ TYPE CONSTRUCTORS COERCION AXIOMS axiom NamedWildcardInTypeFamilyInstanceLHS.D:R:F :: F _t = Int Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/ParensAroundContext.stderr b/testsuite/tests/partial-sigs/should_compile/ParensAroundContext.stderr index e2656ddbed..00ac67bac0 100644 --- a/testsuite/tests/partial-sigs/should_compile/ParensAroundContext.stderr +++ b/testsuite/tests/partial-sigs/should_compile/ParensAroundContext.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES f :: forall a. Eq a => a -> a -> Bool Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/PatBind.stderr b/testsuite/tests/partial-sigs/should_compile/PatBind.stderr index 2db0bebac0..f87bc08da5 100644 --- a/testsuite/tests/partial-sigs/should_compile/PatBind.stderr +++ b/testsuite/tests/partial-sigs/should_compile/PatBind.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES foo :: forall a. a -> a Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/PatBind2.stderr b/testsuite/tests/partial-sigs/should_compile/PatBind2.stderr index 5748b126f2..1021ca94a5 100644 --- a/testsuite/tests/partial-sigs/should_compile/PatBind2.stderr +++ b/testsuite/tests/partial-sigs/should_compile/PatBind2.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES foo :: Bool -> Bool Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/PatternSig.stderr b/testsuite/tests/partial-sigs/should_compile/PatternSig.stderr index 3af6ead3fd..1e425b4a12 100644 --- a/testsuite/tests/partial-sigs/should_compile/PatternSig.stderr +++ b/testsuite/tests/partial-sigs/should_compile/PatternSig.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES bar :: Bool -> Bool Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/Recursive.stderr b/testsuite/tests/partial-sigs/should_compile/Recursive.stderr index 8f8f123d20..0526c83c48 100644 --- a/testsuite/tests/partial-sigs/should_compile/Recursive.stderr +++ b/testsuite/tests/partial-sigs/should_compile/Recursive.stderr @@ -3,5 +3,5 @@ TYPE SIGNATURES g :: Bool orr :: forall a. a -> a -> a Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/ScopedNamedWildcards.stderr b/testsuite/tests/partial-sigs/should_compile/ScopedNamedWildcards.stderr index 08bf6500c6..6b8d06bbbc 100644 --- a/testsuite/tests/partial-sigs/should_compile/ScopedNamedWildcards.stderr +++ b/testsuite/tests/partial-sigs/should_compile/ScopedNamedWildcards.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES test3 :: Bool -> Bool Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/ScopedNamedWildcardsGood.stderr b/testsuite/tests/partial-sigs/should_compile/ScopedNamedWildcardsGood.stderr index bacfd16ac5..bfb0055233 100644 --- a/testsuite/tests/partial-sigs/should_compile/ScopedNamedWildcardsGood.stderr +++ b/testsuite/tests/partial-sigs/should_compile/ScopedNamedWildcardsGood.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES foo :: Bool -> Char Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/ShowNamed.stderr b/testsuite/tests/partial-sigs/should_compile/ShowNamed.stderr index 9ec0a0bfc1..7c5023f7b8 100644 --- a/testsuite/tests/partial-sigs/should_compile/ShowNamed.stderr +++ b/testsuite/tests/partial-sigs/should_compile/ShowNamed.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES showTwo :: forall a. Show a => a -> String Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/SimpleGen.stderr b/testsuite/tests/partial-sigs/should_compile/SimpleGen.stderr index 9d10860ff9..6b6e437ae1 100644 --- a/testsuite/tests/partial-sigs/should_compile/SimpleGen.stderr +++ b/testsuite/tests/partial-sigs/should_compile/SimpleGen.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES bar :: forall _. _ -> Bool Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/SkipMany.stderr b/testsuite/tests/partial-sigs/should_compile/SkipMany.stderr index 25555b46c0..e204febe06 100644 --- a/testsuite/tests/partial-sigs/should_compile/SkipMany.stderr +++ b/testsuite/tests/partial-sigs/should_compile/SkipMany.stderr @@ -8,5 +8,5 @@ TYPE CONSTRUCTORS DATA CONSTRUCTORS GenParser :: forall tok st a. tok -> st -> a -> GenParser tok st a Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/SomethingShowable.stderr b/testsuite/tests/partial-sigs/should_compile/SomethingShowable.stderr index dd83b62933..7f22dd663a 100644 --- a/testsuite/tests/partial-sigs/should_compile/SomethingShowable.stderr +++ b/testsuite/tests/partial-sigs/should_compile/SomethingShowable.stderr @@ -1,7 +1,7 @@ TYPE SIGNATURES somethingShowable :: Show Bool => Bool -> String Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] SomethingShowable.hs:5:1: warning: [-Wsimplifiable-class-constraints (in -Wdefault)] diff --git a/testsuite/tests/partial-sigs/should_compile/TypeFamilyInstanceLHS.stderr b/testsuite/tests/partial-sigs/should_compile/TypeFamilyInstanceLHS.stderr index e0a2bfc2a2..7f15685056 100644 --- a/testsuite/tests/partial-sigs/should_compile/TypeFamilyInstanceLHS.stderr +++ b/testsuite/tests/partial-sigs/should_compile/TypeFamilyInstanceLHS.stderr @@ -12,5 +12,5 @@ FAMILY INSTANCES type instance F Bool _ = Bool -- Defined at TypeFamilyInstanceLHS.hs:8:15 Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/Uncurry.stderr b/testsuite/tests/partial-sigs/should_compile/Uncurry.stderr index e9931d23dd..a006bf1161 100644 --- a/testsuite/tests/partial-sigs/should_compile/Uncurry.stderr +++ b/testsuite/tests/partial-sigs/should_compile/Uncurry.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES unc :: forall _1 _2 _3. (_1 -> _2 -> _3) -> (_1, _2) -> _3 Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/UncurryNamed.stderr b/testsuite/tests/partial-sigs/should_compile/UncurryNamed.stderr index 666fb23620..8b80cbe245 100644 --- a/testsuite/tests/partial-sigs/should_compile/UncurryNamed.stderr +++ b/testsuite/tests/partial-sigs/should_compile/UncurryNamed.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES unc :: forall a b _. (a -> b -> _) -> (a, b) -> _ Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/WarningWildcardInstantiations.stderr b/testsuite/tests/partial-sigs/should_compile/WarningWildcardInstantiations.stderr index 3235f8ec1a..c7898d5d44 100644 --- a/testsuite/tests/partial-sigs/should_compile/WarningWildcardInstantiations.stderr +++ b/testsuite/tests/partial-sigs/should_compile/WarningWildcardInstantiations.stderr @@ -2,7 +2,7 @@ TYPE SIGNATURES bar :: forall t _. t -> (t -> _) -> _ foo :: forall a. (Show a, Enum a) => a -> String Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] WarningWildcardInstantiations.hs:5:14: warning: [-Wpartial-type-signatures (in -Wdefault)] diff --git a/testsuite/tests/perf/compiler/T3064.hs b/testsuite/tests/perf/compiler/T3064.hs index dacca79296..e29dd95564 100644 --- a/testsuite/tests/perf/compiler/T3064.hs +++ b/testsuite/tests/perf/compiler/T3064.hs @@ -19,6 +19,8 @@ instance (Monad m) => Monad (ReaderT r m) where m >>= k = ReaderT $ \r -> do a <- runReaderT m r runReaderT (k a) r + +instance (MonadFail m) => MonadFail (ReaderT r m) where fail msg = ReaderT $ \_ -> fail msg newtype ResourceT r s m v = ResourceT { unResourceT :: ReaderT r m v } diff --git a/testsuite/tests/polykinds/T15592.stderr b/testsuite/tests/polykinds/T15592.stderr index c2aa24d7f3..2f4e1d6ca3 100644 --- a/testsuite/tests/polykinds/T15592.stderr +++ b/testsuite/tests/polykinds/T15592.stderr @@ -5,5 +5,5 @@ DATA CONSTRUCTORS MkT :: forall {k} k1 (f :: k1 -> k -> *) (a :: k1) (b :: k). f a b -> T f a b -> T f a b Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/polykinds/T15592b.stderr b/testsuite/tests/polykinds/T15592b.stderr index 6db525c8a6..918e354021 100644 --- a/testsuite/tests/polykinds/T15592b.stderr +++ b/testsuite/tests/polykinds/T15592b.stderr @@ -4,5 +4,5 @@ TYPE CONSTRUCTORS forall k (f :: k -> *) (a :: k). f a -> * roles nominal nominal nominal nominal Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/profiling/should_run/T3001-2.hs b/testsuite/tests/profiling/should_run/T3001-2.hs index 538a435bec..6511491a46 100644 --- a/testsuite/tests/profiling/should_run/T3001-2.hs +++ b/testsuite/tests/profiling/should_run/T3001-2.hs @@ -192,6 +192,7 @@ instance Monad Get where in unGet (k a) s') {-# INLINE (>>=) #-} +instance MonadFail Get where fail = error "failDesc" instance Applicative Get where diff --git a/testsuite/tests/programs/galois_raytrace/Eval.hs b/testsuite/tests/programs/galois_raytrace/Eval.hs index 001842edad..250c4c4afb 100644 --- a/testsuite/tests/programs/galois_raytrace/Eval.hs +++ b/testsuite/tests/programs/galois_raytrace/Eval.hs @@ -33,7 +33,6 @@ instance Applicative Pure where instance Monad Pure where Pure x >>= k = k x return = pure - fail s = error s instance MonadEval Pure where doOp = doPureOp @@ -306,6 +305,8 @@ instance Monad Abs where AbsState r s' -> runAbs (k r) s' AbsFail m -> AbsFail m) return = pure + +instance MonadFail Abs where fail s = Abs (\ n -> AbsFail s) instance MonadEval Abs where diff --git a/testsuite/tests/quasiquotation/qq005/Expr.hs b/testsuite/tests/quasiquotation/qq005/Expr.hs index 1c51d9db1f..767d906ba4 100644 --- a/testsuite/tests/quasiquotation/qq005/Expr.hs +++ b/testsuite/tests/quasiquotation/qq005/Expr.hs @@ -64,7 +64,7 @@ anti = lexeme $ cs <- many idchar return $ AntiIntExpr (c : cs) -parseExpr :: Monad m => TH.Loc -> String -> m Expr +parseExpr :: MonadFail m => TH.Loc -> String -> m Expr parseExpr (Loc {loc_filename = file, loc_start = (line,col)}) s = case runParser p () "" s of Left err -> fail $ show err diff --git a/testsuite/tests/quasiquotation/qq006/Expr.hs b/testsuite/tests/quasiquotation/qq006/Expr.hs index 1c51d9db1f..767d906ba4 100644 --- a/testsuite/tests/quasiquotation/qq006/Expr.hs +++ b/testsuite/tests/quasiquotation/qq006/Expr.hs @@ -64,7 +64,7 @@ anti = lexeme $ cs <- many idchar return $ AntiIntExpr (c : cs) -parseExpr :: Monad m => TH.Loc -> String -> m Expr +parseExpr :: MonadFail m => TH.Loc -> String -> m Expr parseExpr (Loc {loc_filename = file, loc_start = (line,col)}) s = case runParser p () "" s of Left err -> fail $ show err diff --git a/testsuite/tests/rebindable/DoRestrictedM.hs b/testsuite/tests/rebindable/DoRestrictedM.hs index 2e982c1532..de28079769 100644 --- a/testsuite/tests/rebindable/DoRestrictedM.hs +++ b/testsuite/tests/rebindable/DoRestrictedM.hs @@ -30,11 +30,11 @@ m1 >> m2 = m1 >>= (const m2) newtype RegularM m a = RegularM{unRM :: m a} -instance Prelude.Monad m => MN2 (RegularM m) a where +instance Prelude.MonadFail m => MN2 (RegularM m) a where return = RegularM . Prelude.return - fail = RegularM . Prelude.fail + fail = fail -instance Prelude.Monad m => MN3 (RegularM m) a b where +instance Prelude.MonadFail m => MN3 (RegularM m) a b where m >>= f = RegularM ((Prelude.>>=) (unRM m) (unRM . f)) -- We try to inject Maybe (as the regular monad) into Restricted Monad diff --git a/testsuite/tests/rebindable/RebindableFailA.hs b/testsuite/tests/rebindable/RebindableFailA.hs new file mode 100644 index 0000000000..0fc6444190 --- /dev/null +++ b/testsuite/tests/rebindable/RebindableFailA.hs @@ -0,0 +1,19 @@ +-- Test that RebindableSyntax and the new MonadFail interact correctly. +-- +-- This should fail with the message "Failed with error". + +{-# LANGUAGE RebindableSyntax #-} + +import Prelude hiding (fail) + +fail :: String -> a +fail _ = error "Failed with error" + +f :: Maybe Int -> Maybe () +f x = do + 42 <- x + return () +{-# NOINLINE f #-} + +main = print (f (Just 55)) + diff --git a/testsuite/tests/rebindable/RebindableFailA.stderr b/testsuite/tests/rebindable/RebindableFailA.stderr new file mode 100644 index 0000000000..dfc52f42b0 --- /dev/null +++ b/testsuite/tests/rebindable/RebindableFailA.stderr @@ -0,0 +1,3 @@ +RebindableFailA: Failed with error +CallStack (from HasCallStack): + error, called at RebindableFailA.hs:10:10 in main:Main diff --git a/testsuite/tests/rebindable/RebindableFailB.hs b/testsuite/tests/rebindable/RebindableFailB.hs new file mode 100644 index 0000000000..6c25864685 --- /dev/null +++ b/testsuite/tests/rebindable/RebindableFailB.hs @@ -0,0 +1,20 @@ +-- Test that RebindableSyntax and the new MonadFail interact correctly. +-- +-- This should print "Just ()" + +{-# LANGUAGE RebindableSyntax #-} + +import Prelude hiding (fail) + +fail :: String -> a +fail _ = error "Failed with error" + +f :: Maybe Int -> Maybe () +f x = do + 42 <- x + return () +{-# NOINLINE f #-} + +main = print (f (Just 42)) + + diff --git a/testsuite/tests/rebindable/RebindableFailB.stdout b/testsuite/tests/rebindable/RebindableFailB.stdout new file mode 100644 index 0000000000..7c2c1d94b9 --- /dev/null +++ b/testsuite/tests/rebindable/RebindableFailB.stdout @@ -0,0 +1 @@ +Just () diff --git a/testsuite/tests/rebindable/T5908.hs b/testsuite/tests/rebindable/T5908.hs index 2666c3371a..ff5da8949a 100644 --- a/testsuite/tests/rebindable/T5908.hs +++ b/testsuite/tests/rebindable/T5908.hs @@ -25,11 +25,9 @@ class Monad m where (>>=) :: forall e ex x a b . m e ex a -> (a -> m ex x b) -> m e x b (>>) :: forall e ex x a b . m e ex a -> m ex x b -> m e x b return :: a -> m ex ex a - fail :: String -> m e x a {-# INLINE (>>) #-} m >> k = m >>= \ _ -> k - fail = error type Writer w = WriterT w Identity @@ -60,9 +58,6 @@ instance (Category w, Prelude.Monad m) => Monad (WriterT w m) where where (>>=) = (Prelude.>>=) return = Prelude.return - fail msg = WriterT $ fail msg - where - fail = Prelude.fail tell :: (Category w, Prelude.Monad m) => w e x -> WriterT w m e x () tell w = WriterT $ return ((), w) diff --git a/testsuite/tests/rebindable/all.T b/testsuite/tests/rebindable/all.T index 7c8caea438..2caa486d9b 100644 --- a/testsuite/tests/rebindable/all.T +++ b/testsuite/tests/rebindable/all.T @@ -20,10 +20,8 @@ test('rebindable7', normal, compile_and_run, ['']) test('rebindable8', normal, compile, ['']) test('rebindable9', normal, compile, ['']) test('rebindable10', normal, compile_and_run, ['']) - -# Test rebindable clash warnings -test('rebindable11', normal, compile, ['']) -test('rebindable12', normal, compile_fail, ['']) +test('RebindableFailA', exit_code(1), compile_and_run, ['']) +test('RebindableFailB', normal, compile_and_run, ['']) test('T303', normal, compile, ['']) diff --git a/testsuite/tests/rebindable/rebindable1.hs b/testsuite/tests/rebindable/rebindable1.hs index fcbe52fbc1..f966624710 100644 --- a/testsuite/tests/rebindable/rebindable1.hs +++ b/testsuite/tests/rebindable/rebindable1.hs @@ -1,5 +1,4 @@ -{-# OPTIONS_GHC -Wno-missing-monadfail-instances #-} -{-# LANGUAGE RebindableSyntax, NPlusKPatterns, NoMonadFailDesugaring #-} +{-# LANGUAGE RebindableSyntax, NPlusKPatterns #-} module RebindableCase1 where { diff --git a/testsuite/tests/rebindable/rebindable11.hs b/testsuite/tests/rebindable/rebindable11.hs deleted file mode 100644 index 13e1b2dd3d..0000000000 --- a/testsuite/tests/rebindable/rebindable11.hs +++ /dev/null @@ -1,15 +0,0 @@ -{-# LANGUAGE RebindableSyntax, MonadFailDesugaring #-} -{-# OPTIONS_GHC -Wno-missing-monadfail-instances #-} - --- Test that rebindable clash warnings are not displayed. This program --- should not generate anything on stderr at compile time. - -module Main where - -import Prelude - -catMaybes xs = do - Just x <- xs - return x - -main = return () diff --git a/testsuite/tests/rebindable/rebindable11.stderr b/testsuite/tests/rebindable/rebindable11.stderr deleted file mode 100644 index e69de29bb2..0000000000 --- a/testsuite/tests/rebindable/rebindable11.stderr +++ /dev/null diff --git a/testsuite/tests/rebindable/rebindable12.hs b/testsuite/tests/rebindable/rebindable12.hs deleted file mode 100644 index fd2e1c7bb3..0000000000 --- a/testsuite/tests/rebindable/rebindable12.hs +++ /dev/null @@ -1,14 +0,0 @@ -{-# LANGUAGE RebindableSyntax, MonadFailDesugaring #-} -{-# OPTIONS_GHC -Wmissing-monadfail-instances #-} - --- Test that rebindable clash warnings are displayed. - -module Main where - -import Prelude - -catMaybes xs = do - Just x <- xs - return x - -main = return () diff --git a/testsuite/tests/rebindable/rebindable12.stderr b/testsuite/tests/rebindable/rebindable12.stderr deleted file mode 100644 index 722a95c293..0000000000 --- a/testsuite/tests/rebindable/rebindable12.stderr +++ /dev/null @@ -1,4 +0,0 @@ -rebindable12.hs:11:5: error: [-Wmissing-monadfail-instances (in -Wcompat), -Werror=missing-monadfail-instances] - The failable pattern ‘Just x’ - is used together with -XRebindableSyntax. If this is intentional, - compile with -Wno-missing-monadfail-instances. diff --git a/testsuite/tests/rebindable/rebindable2.hs b/testsuite/tests/rebindable/rebindable2.hs index 9fe15150f4..3858d2b9f3 100644 --- a/testsuite/tests/rebindable/rebindable2.hs +++ b/testsuite/tests/rebindable/rebindable2.hs @@ -8,7 +8,7 @@ module Main where import Prelude(String,undefined,Maybe(..),IO,putStrLn, Integer,(++),Rational, (==), (>=) ); - import Prelude(Monad(..),Applicative(..),Functor(..)); + import Prelude(Monad(..),Applicative(..),Functor(..),MonadFail(..)); import Control.Monad(ap, liftM); debugFunc :: String -> IO a -> IO a; @@ -35,7 +35,9 @@ module Main where (>>=) ma amb = MkTM (debugFunc ">>=" ((Prelude.>>=) (unTM ma) (\a -> unTM (amb a)))); (>>) ma mb = MkTM (debugFunc ">>" ((Prelude.>>) (unTM ma) (unTM mb))); - + }; + instance (MonadFail TM) where + { fail s = MkTM (debugFunc "fail" (Prelude.return undefined)); }; diff --git a/testsuite/tests/rename/should_fail/rnfail040.stderr b/testsuite/tests/rename/should_fail/rnfail040.stderr index f16607c07f..33f2f8cba9 100644 --- a/testsuite/tests/rename/should_fail/rnfail040.stderr +++ b/testsuite/tests/rename/should_fail/rnfail040.stderr @@ -3,7 +3,7 @@ rnfail040.hs:7:12: error: Conflicting exports for ‘nub’: ‘module M’ exports ‘M.nub’ imported from ‘Data.List’ at rnfail040.hs:10:2-22 - (and originally defined in ‘base-4.12.0.0:Data.OldList’) + (and originally defined in ‘base-4.13.0.0:Data.OldList’) ‘module M’ exports ‘T.nub’ imported from ‘Rnfail040_A’ at rnfail040.hs:11:2-24 (and originally defined at Rnfail040_A.hs:2:3-5) diff --git a/testsuite/tests/roles/should_compile/Roles1.stderr b/testsuite/tests/roles/should_compile/Roles1.stderr index a54b9e9856..b7ee3ade66 100644 --- a/testsuite/tests/roles/should_compile/Roles1.stderr +++ b/testsuite/tests/roles/should_compile/Roles1.stderr @@ -20,7 +20,7 @@ DATA CONSTRUCTORS K2 :: forall a. a -> T2 a K1 :: forall a. a -> T1 a Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] ==================== Typechecker ==================== diff --git a/testsuite/tests/roles/should_compile/Roles14.stderr b/testsuite/tests/roles/should_compile/Roles14.stderr index 8df56e5fc6..1e20e0c49f 100644 --- a/testsuite/tests/roles/should_compile/Roles14.stderr +++ b/testsuite/tests/roles/should_compile/Roles14.stderr @@ -6,7 +6,7 @@ TYPE CONSTRUCTORS COERCION AXIOMS axiom Roles12.N:C2 :: C2 a = a -> a Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] ==================== Typechecker ==================== diff --git a/testsuite/tests/roles/should_compile/Roles2.stderr b/testsuite/tests/roles/should_compile/Roles2.stderr index 425cc0c8de..50b9074455 100644 --- a/testsuite/tests/roles/should_compile/Roles2.stderr +++ b/testsuite/tests/roles/should_compile/Roles2.stderr @@ -6,7 +6,7 @@ DATA CONSTRUCTORS K2 :: forall a. FunPtr a -> T2 a K1 :: forall a. IO a -> T1 a Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] ==================== Typechecker ==================== diff --git a/testsuite/tests/roles/should_compile/Roles3.stderr b/testsuite/tests/roles/should_compile/Roles3.stderr index 16fbdf037c..b0f8e9c7cc 100644 --- a/testsuite/tests/roles/should_compile/Roles3.stderr +++ b/testsuite/tests/roles/should_compile/Roles3.stderr @@ -21,7 +21,7 @@ COERCION AXIOMS axiom Roles3.N:C3 :: C3 a b = a -> F3 b -> F3 b axiom Roles3.N:C4 :: C4 a b = a -> F4 b -> F4 b Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] ==================== Typechecker ==================== diff --git a/testsuite/tests/roles/should_compile/Roles4.stderr b/testsuite/tests/roles/should_compile/Roles4.stderr index eb5d26a6d4..3bcddb294e 100644 --- a/testsuite/tests/roles/should_compile/Roles4.stderr +++ b/testsuite/tests/roles/should_compile/Roles4.stderr @@ -9,7 +9,7 @@ COERCION AXIOMS axiom Roles4.N:C1 :: C1 a = a -> a axiom Roles4.N:C3 :: C3 a = a -> Syn1 a Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] ==================== Typechecker ==================== diff --git a/testsuite/tests/roles/should_compile/T8958.stderr b/testsuite/tests/roles/should_compile/T8958.stderr index 930c05b2d7..3bab78bc0b 100644 --- a/testsuite/tests/roles/should_compile/T8958.stderr +++ b/testsuite/tests/roles/should_compile/T8958.stderr @@ -16,7 +16,7 @@ CLASS INSTANCES -- Defined at T8958.hs:10:10 instance [incoherent] Nominal a -- Defined at T8958.hs:7:10 Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] ==================== Typechecker ==================== diff --git a/testsuite/tests/safeHaskell/check/Check01.stderr b/testsuite/tests/safeHaskell/check/Check01.stderr index 3140ab7f0c..5c8b8a3da5 100644 --- a/testsuite/tests/safeHaskell/check/Check01.stderr +++ b/testsuite/tests/safeHaskell/check/Check01.stderr @@ -1,4 +1,4 @@ [3 of 3] Compiling Check01 ( Check01.hs, Check01.o ) <no location info>: error: - The package (base-4.12.0.0) is required to be trusted but it isn't! + The package (base-4.13.0.0) is required to be trusted but it isn't! diff --git a/testsuite/tests/safeHaskell/check/Check06.stderr b/testsuite/tests/safeHaskell/check/Check06.stderr index 6584b1e049..b533b3c357 100644 --- a/testsuite/tests/safeHaskell/check/Check06.stderr +++ b/testsuite/tests/safeHaskell/check/Check06.stderr @@ -2,4 +2,4 @@ [2 of 2] Compiling Check06 ( Check06.hs, Check06.o ) <no location info>: error: - The package (base-4.12.0.0) is required to be trusted but it isn't! + The package (base-4.13.0.0) is required to be trusted but it isn't! diff --git a/testsuite/tests/safeHaskell/check/Check08.stderr b/testsuite/tests/safeHaskell/check/Check08.stderr index 36c2f255b4..d83ad784fd 100644 --- a/testsuite/tests/safeHaskell/check/Check08.stderr +++ b/testsuite/tests/safeHaskell/check/Check08.stderr @@ -3,4 +3,4 @@ [3 of 3] Compiling Check08 ( Check08.hs, Check08.o ) <no location info>: error: - The package (base-4.12.0.0) is required to be trusted but it isn't! + The package (base-4.13.0.0) is required to be trusted but it isn't! diff --git a/testsuite/tests/safeHaskell/check/Check09.stderr b/testsuite/tests/safeHaskell/check/Check09.stderr index f83d7d18e5..6d1e031075 100644 --- a/testsuite/tests/safeHaskell/check/Check09.stderr +++ b/testsuite/tests/safeHaskell/check/Check09.stderr @@ -1,8 +1,8 @@ Check09.hs:4:1: error: Prelude: Can't be safely imported! - The package (base-4.12.0.0) the module resides in isn't trusted. + The package (base-4.13.0.0) the module resides in isn't trusted. Check09.hs:5:1: error: Data.ByteString.Char8: Can't be safely imported! - The package (bytestring-0.10.8.2) the module resides in isn't trusted. + The package (bytestring-0.10.9.0) the module resides in isn't trusted. diff --git a/testsuite/tests/safeHaskell/check/pkg01/ImpSafe01.stderr b/testsuite/tests/safeHaskell/check/pkg01/ImpSafe01.stderr index fd9bd4a6b3..5e4918e66f 100644 --- a/testsuite/tests/safeHaskell/check/pkg01/ImpSafe01.stderr +++ b/testsuite/tests/safeHaskell/check/pkg01/ImpSafe01.stderr @@ -1,4 +1,4 @@ ImpSafe01.hs:9:1: error: Data.Word: Can't be safely imported! - The package (base-4.12.0.0) the module resides in isn't trusted. + The package (base-4.13.0.0) the module resides in isn't trusted. diff --git a/testsuite/tests/safeHaskell/check/pkg01/ImpSafe04.stderr b/testsuite/tests/safeHaskell/check/pkg01/ImpSafe04.stderr index 2b15817190..cf9f32de45 100644 --- a/testsuite/tests/safeHaskell/check/pkg01/ImpSafe04.stderr +++ b/testsuite/tests/safeHaskell/check/pkg01/ImpSafe04.stderr @@ -1,4 +1,4 @@ ImpSafe04.hs:9:1: error: Data.Word: Can't be safely imported! - The package (base-4.12.0.0) the module resides in isn't trusted. + The package (base-4.13.0.0) the module resides in isn't trusted. diff --git a/testsuite/tests/safeHaskell/flags/SafeFlags17.stderr b/testsuite/tests/safeHaskell/flags/SafeFlags17.stderr index 27b68adf11..4f8eae80b9 100644 --- a/testsuite/tests/safeHaskell/flags/SafeFlags17.stderr +++ b/testsuite/tests/safeHaskell/flags/SafeFlags17.stderr @@ -1,4 +1,4 @@ SafeFlags17.hs:4:8: error: Prelude: Can't be safely imported! - The package (base-4.12.0.0) the module resides in isn't trusted. + The package (base-4.13.0.0) the module resides in isn't trusted. diff --git a/testsuite/tests/simplCore/prog002/Simpl009Help.hs b/testsuite/tests/simplCore/prog002/Simpl009Help.hs index e4c6df351e..b64639ec8a 100644 --- a/testsuite/tests/simplCore/prog002/Simpl009Help.hs +++ b/testsuite/tests/simplCore/prog002/Simpl009Help.hs @@ -28,9 +28,6 @@ instance Monad (Parser s) where Parser f >>= k = Parser (\fut -> f (\a -> let Parser g = k a in g fut)) - fail s = - Parser (\fut exp -> Fail exp [s]) - instance Alternative (Parser s) where empty = mzero (<|>) = mplus diff --git a/testsuite/tests/simplCore/should_compile/T8331.hs b/testsuite/tests/simplCore/should_compile/T8331.hs index 04cb1aff73..a7dc318826 100644 --- a/testsuite/tests/simplCore/should_compile/T8331.hs +++ b/testsuite/tests/simplCore/should_compile/T8331.hs @@ -23,6 +23,8 @@ instance (Monad m) => Monad (ReaderT r m) where m >>= k = ReaderT $ \ r -> do a <- runReaderT m r runReaderT (k a) r + +instance MonadFail m => MonadFail (ReaderT r m) where fail msg = ReaderT (\_ -> fail msg) mapReaderT :: (m a -> n b) -> ReaderT r m a -> ReaderT r n b diff --git a/testsuite/tests/th/T15321.stderr b/testsuite/tests/th/T15321.stderr index 7807bcf5a2..825e01b0f4 100644 --- a/testsuite/tests/th/T15321.stderr +++ b/testsuite/tests/th/T15321.stderr @@ -5,8 +5,8 @@ T15321.hs:9:9: error: In the expression: _ "baz" In the untyped splice: $(_ "baz") • Valid hole fits include - fail :: forall (m :: * -> *) a. Monad m => String -> m a + fail :: forall (m :: * -> *) a. MonadFail m => String -> m a with fail @Language.Haskell.TH.Syntax.Q @Language.Haskell.TH.Syntax.Exp (imported from ‘Prelude’ at T15321.hs:3:8-13 - (and originally defined in ‘GHC.Base’)) + (and originally defined in ‘Control.Monad.Fail’)) diff --git a/testsuite/tests/typecheck/should_compile/T12763.stderr b/testsuite/tests/typecheck/should_compile/T12763.stderr index eff7c0a28f..d5abb6c6af 100644 --- a/testsuite/tests/typecheck/should_compile/T12763.stderr +++ b/testsuite/tests/typecheck/should_compile/T12763.stderr @@ -8,5 +8,5 @@ COERCION AXIOMS CLASS INSTANCES instance C Int -- Defined at T12763.hs:9:10 Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/typecheck/should_compile/T15645.stderr b/testsuite/tests/typecheck/should_compile/T15645.stderr deleted file mode 100644 index 566d6bf18e..0000000000 --- a/testsuite/tests/typecheck/should_compile/T15645.stderr +++ /dev/null @@ -1,4 +0,0 @@ -T15645.hs:8:5: warning: [-Wmissing-monadfail-instances (in -Wcompat)] - The failable pattern ‘Just y’ - is used together with -XRebindableSyntax. If this is intentional, - compile with -Wno-missing-monadfail-instances. diff --git a/testsuite/tests/typecheck/should_compile/T4524.hs b/testsuite/tests/typecheck/should_compile/T4524.hs index 669c4b268a..fbdc0cd77c 100644 --- a/testsuite/tests/typecheck/should_compile/T4524.hs +++ b/testsuite/tests/typecheck/should_compile/T4524.hs @@ -174,6 +174,8 @@ instance Monad Perhaps where (Succeeded _) >> k = k Unknown >> k = k return = Succeeded + +instance MonadFail Perhaps where fail _ = Unknown instance Alternative Perhaps where diff --git a/testsuite/tests/typecheck/should_compile/T4969.hs b/testsuite/tests/typecheck/should_compile/T4969.hs index 6a087974c7..b8332bdcba 100644 --- a/testsuite/tests/typecheck/should_compile/T4969.hs +++ b/testsuite/tests/typecheck/should_compile/T4969.hs @@ -89,7 +89,6 @@ instance Applicative (TCMT m) where instance Monad (TCMT m) where return = undefined (>>=) = undefined - fail = undefined instance Monad m => MonadIO (TCMT m) where diff --git a/testsuite/tests/typecheck/should_compile/Tc239_Help.hs b/testsuite/tests/typecheck/should_compile/Tc239_Help.hs index 4f39612e4e..1718c99088 100644 --- a/testsuite/tests/typecheck/should_compile/Tc239_Help.hs +++ b/testsuite/tests/typecheck/should_compile/Tc239_Help.hs @@ -20,4 +20,3 @@ instance Monad (WrapIO e) where m >>= f = MkWrapIO (do x <- unwrap m unwrap (f x) ) - fail str = error str
\ No newline at end of file diff --git a/testsuite/tests/typecheck/should_compile/abstract_refinement_hole_fits.stderr b/testsuite/tests/typecheck/should_compile/abstract_refinement_hole_fits.stderr index d3ea7d4533..227df63ecc 100644 --- a/testsuite/tests/typecheck/should_compile/abstract_refinement_hole_fits.stderr +++ b/testsuite/tests/typecheck/should_compile/abstract_refinement_hole_fits.stderr @@ -36,8 +36,6 @@ abstract_refinement_hole_fits.hs:4:5: warning: [-Wtyped-holes (in -Wdefault)] where const :: forall a b. a -> b -> a ($) (_ :: [Integer] -> Integer) where ($) :: forall a b. (a -> b) -> a -> b - fail (_ :: [Char]) - where fail :: forall (m :: * -> *) a. Monad m => String -> m a return (_ :: Integer) where return :: forall (m :: * -> *) a. Monad m => a -> m a pure (_ :: Integer) @@ -116,8 +114,6 @@ abstract_refinement_hole_fits.hs:4:5: warning: [-Wtyped-holes (in -Wdefault)] where const :: forall a b. a -> b -> a ($) (_ :: a5 -> [Integer] -> Integer) (_ :: a5) where ($) :: forall a b. (a -> b) -> a -> b - fail (_ :: [Char]) (_ :: t1) - where fail :: forall (m :: * -> *) a. Monad m => String -> m a return (_ :: [Integer] -> Integer) (_ :: t1) where return :: forall (m :: * -> *) a. Monad m => a -> m a pure (_ :: [Integer] -> Integer) (_ :: t1) @@ -156,8 +152,6 @@ abstract_refinement_hole_fits.hs:7:5: warning: [-Wtyped-holes (in -Wdefault)] where const :: forall a b. a -> b -> a ($) (_ :: Integer -> [Integer] -> Integer) where ($) :: forall a b. (a -> b) -> a -> b - fail (_ :: [Char]) - where fail :: forall (m :: * -> *) a. Monad m => String -> m a return (_ :: [Integer] -> Integer) where return :: forall (m :: * -> *) a. Monad m => a -> m a pure (_ :: [Integer] -> Integer) @@ -240,8 +234,6 @@ abstract_refinement_hole_fits.hs:7:5: warning: [-Wtyped-holes (in -Wdefault)] where const :: forall a b. a -> b -> a ($) (_ :: a5 -> Integer -> [Integer] -> Integer) (_ :: a5) where ($) :: forall a b. (a -> b) -> a -> b - fail (_ :: [Char]) (_ :: t1) - where fail :: forall (m :: * -> *) a. Monad m => String -> m a return (_ :: Integer -> [Integer] -> Integer) (_ :: t1) where return :: forall (m :: * -> *) a. Monad m => a -> m a pure (_ :: Integer -> [Integer] -> Integer) (_ :: t1) diff --git a/testsuite/tests/typecheck/should_compile/constraint_hole_fits.stderr b/testsuite/tests/typecheck/should_compile/constraint_hole_fits.stderr index 3ba80087e5..233f8e23d2 100644 --- a/testsuite/tests/typecheck/should_compile/constraint_hole_fits.stderr +++ b/testsuite/tests/typecheck/should_compile/constraint_hole_fits.stderr @@ -37,8 +37,6 @@ constraint_hole_fits.hs:4:5: warning: [-Wtyped-holes (in -Wdefault)] where const :: forall a b. a -> b -> a ($) (_ :: [a] -> a) where ($) :: forall a b. (a -> b) -> a -> b - fail (_ :: [Char]) - where fail :: forall (m :: * -> *) a. Monad m => String -> m a return (_ :: a) where return :: forall (m :: * -> *) a. Monad m => a -> m a pure (_ :: a) diff --git a/testsuite/tests/typecheck/should_compile/refinement_hole_fits.stderr b/testsuite/tests/typecheck/should_compile/refinement_hole_fits.stderr index 888680d228..51e29fd3a2 100644 --- a/testsuite/tests/typecheck/should_compile/refinement_hole_fits.stderr +++ b/testsuite/tests/typecheck/should_compile/refinement_hole_fits.stderr @@ -71,11 +71,6 @@ refinement_hole_fits.hs:4:5: warning: [-Wtyped-holes (in -Wdefault)] with ($) @'GHC.Types.LiftedRep @[Integer] @Integer (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30 (and originally defined in ‘GHC.Base’)) - fail (_ :: [Char]) - where fail :: forall (m :: * -> *) a. Monad m => String -> m a - with fail @((->) [Integer]) @Integer - (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30 - (and originally defined in ‘GHC.Base’)) return (_ :: Integer) where return :: forall (m :: * -> *) a. Monad m => a -> m a with return @((->) [Integer]) @Integer @@ -172,11 +167,6 @@ refinement_hole_fits.hs:7:5: warning: [-Wtyped-holes (in -Wdefault)] with ($) @'GHC.Types.LiftedRep @Integer @([Integer] -> Integer) (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30 (and originally defined in ‘GHC.Base’)) - fail (_ :: [Char]) - where fail :: forall (m :: * -> *) a. Monad m => String -> m a - with fail @((->) Integer) @([Integer] -> Integer) - (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30 - (and originally defined in ‘GHC.Base’)) return (_ :: [Integer] -> Integer) where return :: forall (m :: * -> *) a. Monad m => a -> m a with return @((->) Integer) @([Integer] -> Integer) diff --git a/testsuite/tests/typecheck/should_compile/subsumption_sort_hole_fits.stderr b/testsuite/tests/typecheck/should_compile/subsumption_sort_hole_fits.stderr index 7751113761..0d15bc4d1d 100644 --- a/testsuite/tests/typecheck/should_compile/subsumption_sort_hole_fits.stderr +++ b/testsuite/tests/typecheck/should_compile/subsumption_sort_hole_fits.stderr @@ -9,10 +9,10 @@ subsumption_sort_hole_fits.hs:2:5: warning: [-Wtyped-holes (in -Wdefault)] Valid hole fits include lines :: String -> [String] (imported from ‘Prelude’ at subsumption_sort_hole_fits.hs:1:1 - (and originally defined in ‘base-4.12.0.0:Data.OldList’)) + (and originally defined in ‘base-4.13.0.0:Data.OldList’)) words :: String -> [String] (imported from ‘Prelude’ at subsumption_sort_hole_fits.hs:1:1 - (and originally defined in ‘base-4.12.0.0:Data.OldList’)) + (and originally defined in ‘base-4.13.0.0:Data.OldList’)) read :: forall a. Read a => String -> a with read @[String] (imported from ‘Prelude’ at subsumption_sort_hole_fits.hs:1:1 @@ -25,6 +25,10 @@ subsumption_sort_hole_fits.hs:2:5: warning: [-Wtyped-holes (in -Wdefault)] with mempty @([Char] -> [String]) (imported from ‘Prelude’ at subsumption_sort_hole_fits.hs:1:1 (and originally defined in ‘GHC.Base’)) + fail :: forall (m :: * -> *) a. MonadFail m => String -> m a + with fail @[] @String + (imported from ‘Prelude’ at subsumption_sort_hole_fits.hs:1:1 + (and originally defined in ‘Control.Monad.Fail’)) return :: forall (m :: * -> *) a. Monad m => a -> m a with return @[] @String (imported from ‘Prelude’ at subsumption_sort_hole_fits.hs:1:1 @@ -33,7 +37,3 @@ subsumption_sort_hole_fits.hs:2:5: warning: [-Wtyped-holes (in -Wdefault)] with pure @[] @String (imported from ‘Prelude’ at subsumption_sort_hole_fits.hs:1:1 (and originally defined in ‘GHC.Base’)) - fail :: forall (m :: * -> *) a. Monad m => String -> m a - with fail @[] @String - (imported from ‘Prelude’ at subsumption_sort_hole_fits.hs:1:1 - (and originally defined in ‘GHC.Base’)) diff --git a/testsuite/tests/typecheck/should_compile/tc231.stderr b/testsuite/tests/typecheck/should_compile/tc231.stderr index 8340d3f033..ed38d5309a 100644 --- a/testsuite/tests/typecheck/should_compile/tc231.stderr +++ b/testsuite/tests/typecheck/should_compile/tc231.stderr @@ -15,5 +15,5 @@ DATA CONSTRUCTORS Z :: forall a. a -> Z a Node :: forall s a chain. s -> a -> chain -> Q s a chain Dependent modules: [] -Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, +Dependent packages: [base-4.13.0.0, ghc-prim-0.5.3, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/typecheck/should_compile/valid_hole_fits.stderr b/testsuite/tests/typecheck/should_compile/valid_hole_fits.stderr index c9d6f44e20..355bfe959c 100644 --- a/testsuite/tests/typecheck/should_compile/valid_hole_fits.stderr +++ b/testsuite/tests/typecheck/should_compile/valid_hole_fits.stderr @@ -244,10 +244,10 @@ valid_hole_fits.hs:41:8: warning: [-Wtyped-holes (in -Wdefault)] with print @[Char] (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40 (and originally defined in ‘System.IO’)) - fail :: forall (m :: * -> *) a. Monad m => String -> m a + fail :: forall (m :: * -> *) a. MonadFail m => String -> m a with fail @IO @() (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40 - (and originally defined in ‘GHC.Base’)) + (and originally defined in ‘Control.Monad.Fail’)) mempty :: forall a. Monoid a => a with mempty @([Char] -> IO ()) (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40 diff --git a/testsuite/tests/typecheck/should_fail/TcStaticPointersFail02.stderr b/testsuite/tests/typecheck/should_fail/TcStaticPointersFail02.stderr index c4d811c567..ef6e0def11 100644 --- a/testsuite/tests/typecheck/should_fail/TcStaticPointersFail02.stderr +++ b/testsuite/tests/typecheck/should_fail/TcStaticPointersFail02.stderr @@ -1,13 +1,13 @@ TcStaticPointersFail02.hs:9:6: error: - • No instance for (base-4.12.0.0:Data.Typeable.Internal.Typeable b) + • No instance for (base-4.13.0.0:Data.Typeable.Internal.Typeable b) arising from a static form • In the expression: static (undefined :: (forall a. a -> a) -> b) In an equation for ‘f1’: f1 = static (undefined :: (forall a. a -> a) -> b) TcStaticPointersFail02.hs:12:6: error: - • No instance for (base-4.12.0.0:Data.Typeable.Internal.Typeable + • No instance for (base-4.13.0.0:Data.Typeable.Internal.Typeable (Monad m => a -> m a)) arising from a static form (maybe you haven't applied a function to enough arguments?) diff --git a/testsuite/tests/typecheck/should_fail/tcfail182.stderr b/testsuite/tests/typecheck/should_fail/tcfail182.stderr index 35e2e2d2c9..e57c3c1672 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail182.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail182.stderr @@ -4,7 +4,7 @@ tcfail182.hs:9:3: error: with actual type ‘Maybe a0’ NB: ‘Maybe’ is defined at tcfail182.hs:6:1-18 ‘Prelude.Maybe’ - is defined in ‘GHC.Maybe’ in package ‘base-4.12.0.0’ + is defined in ‘GHC.Maybe’ in package ‘base-4.13.0.0’ • In the pattern: Foo In an equation for ‘f’: f Foo = 3 • Relevant bindings include diff --git a/testsuite/tests/typecheck/should_run/T1735_Help/State.hs b/testsuite/tests/typecheck/should_run/T1735_Help/State.hs index 44078ae944..093a7e2c81 100644 --- a/testsuite/tests/typecheck/should_run/T1735_Help/State.hs +++ b/testsuite/tests/typecheck/should_run/T1735_Help/State.hs @@ -11,7 +11,9 @@ instance Monad m => Monad (StateT s m) where m >>= k = StateT $ \s -> do ~(a, s') <- runStateT m s runStateT (k a) s' - fail str = StateT $ \_ -> fail str + +instance MonadFail m => MonadFail (StateT s m) where + fail s = StateT $ \_ -> fail s instance Monad m => Functor (StateT s m) where fmap = liftM diff --git a/testsuite/tests/warnings/should_compile/T11128.hs b/testsuite/tests/warnings/should_compile/T11128.hs deleted file mode 100644 index 23725c1e4b..0000000000 --- a/testsuite/tests/warnings/should_compile/T11128.hs +++ /dev/null @@ -1,50 +0,0 @@ -{-# LANGUAGE DeriveFunctor #-} -{-# OPTIONS_GHC -fwarn-noncanonical-monad-instances #-} - --- | Test noncanonical-monad-instances warnings -module T11128 where - -import Control.Applicative as A -import Control.Monad as M - ----------------------------------------------------------------------------- --- minimal definition - -data T0 a = T0 a deriving Functor - -instance A.Applicative T0 where - pure = T0 - (<*>) = M.ap - -instance M.Monad T0 where - (>>=) = undefined - ----------------------------------------------------------------------------- --- trigger all 4 warnings - -data T1 a = T1 a deriving Functor - -instance A.Applicative T1 where - pure = return - (<*>) = M.ap - (*>) = (M.>>) - -instance M.Monad T1 where - (>>=) = undefined - return = T1 - (>>) = undefined - ----------------------------------------------------------------------------- --- backward compat canonical definition - -data T2 a = T2 a deriving Functor - -instance Applicative T2 where - pure = T2 - (<*>) = ap - (*>) = undefined - -instance M.Monad T2 where - (>>=) = undefined - return = pure - (>>) = (*>) diff --git a/testsuite/tests/warnings/should_compile/T11128.stderr b/testsuite/tests/warnings/should_compile/T11128.stderr deleted file mode 100644 index b8d788236c..0000000000 --- a/testsuite/tests/warnings/should_compile/T11128.stderr +++ /dev/null @@ -1,20 +0,0 @@ - -T11128.hs:28:5: warning: [-Wnoncanonical-monad-instances] - Noncanonical ‘pure = return’ definition detected - in the instance declaration for ‘Applicative T1’. - Move definition from ‘return’ to ‘pure’ - -T11128.hs:30:5: warning: [-Wnoncanonical-monad-instances] - Noncanonical ‘(*>) = (>>)’ definition detected - in the instance declaration for ‘Applicative T1’. - Move definition from ‘(>>)’ to ‘(*>)’ - -T11128.hs:34:5: warning: [-Wnoncanonical-monad-instances] - Noncanonical ‘return’ definition detected - in the instance declaration for ‘Monad T1’. - Either remove definition for ‘return’ or define as ‘return = pure’ - -T11128.hs:35:5: warning: [-Wnoncanonical-monad-instances] - Noncanonical ‘(>>)’ definition detected - in the instance declaration for ‘Monad T1’. - Either remove definition for ‘(>>)’ or define as ‘(>>) = (*>)’ diff --git a/testsuite/tests/warnings/should_compile/T11128b.hs b/testsuite/tests/warnings/should_compile/T11128b.hs deleted file mode 100644 index 497927716c..0000000000 --- a/testsuite/tests/warnings/should_compile/T11128b.hs +++ /dev/null @@ -1,64 +0,0 @@ -{-# LANGUAGE DeriveFunctor #-} -{-# OPTIONS_GHC -Wnoncanonical-monadfail-instances #-} - --- | Test noncanonical-monadfail-instances warnings -module T11128b where - -import Control.Applicative as A -import Control.Monad as M -import Control.Monad.Fail as MF - ----------------------------------------------------------------------------- --- minimal definition - -data T0 a = T0 a deriving Functor - -instance A.Applicative T0 where - pure = T0 - (<*>) = M.ap - -instance M.Monad T0 where - (>>=) = undefined - -instance MF.MonadFail T0 where - fail = error "fail" - ----------------------------------------------------------------------------- --- trigger all 2 warnings - -data T1 a = T1 a deriving Functor - -instance A.Applicative T1 where - pure = return - (<*>) = M.ap - (*>) = (M.>>) - -instance M.Monad T1 where - (>>=) = undefined - return = T1 - (>>) = undefined - fail = error "fail" - -instance MF.MonadFail T1 where - fail = M.fail - ----------------------------------------------------------------------------- --- backward compat canonical definition - -data T2 a = T2 a deriving Functor - -instance Applicative T2 where - pure = T2 - (<*>) = ap - (*>) = undefined - -instance M.Monad T2 where - (>>=) = undefined - return = pure - (>>) = (*>) - fail = MF.fail - -instance MF.MonadFail T2 where - fail = error "fail" - ----------------------------------------------------------------------------- diff --git a/testsuite/tests/warnings/should_compile/T11128b.stderr b/testsuite/tests/warnings/should_compile/T11128b.stderr deleted file mode 100644 index e3fd3e83dc..0000000000 --- a/testsuite/tests/warnings/should_compile/T11128b.stderr +++ /dev/null @@ -1,10 +0,0 @@ - -T11128b.hs:40:5: warning: [-Wnoncanonical-monadfail-instances] - Noncanonical ‘fail’ definition detected - in the instance declaration for ‘Monad T1’. - Either remove definition for ‘fail’ or define as ‘fail = Control.Monad.Fail.fail’ - -T11128b.hs:43:5: warning: [-Wnoncanonical-monadfail-instances] - Noncanonical ‘fail = Control.Monad.fail’ definition detected - in the instance declaration for ‘MonadFail T1’. - Move definition from ‘Control.Monad.fail’ to ‘fail’ diff --git a/testsuite/tests/warnings/should_compile/all.T b/testsuite/tests/warnings/should_compile/all.T index 10a3ecf12c..36e6b1beeb 100644 --- a/testsuite/tests/warnings/should_compile/all.T +++ b/testsuite/tests/warnings/should_compile/all.T @@ -9,8 +9,6 @@ test('T10908', normal, compile, ['']) test('T10930', normal, compile, ['']) test('T10930b', normal, compile, ['']) test('T11077', normal, compile, ['-fwarn-missing-exported-signatures']) -test('T11128', normal, compile, ['']) -test('T11128b', normal, compile, ['']) test('T13256', normal, compile, ['']) test('T15460', normal, compile, ['']) test('PluralS', normal, compile, ['']) diff --git a/testsuite/tests/wcompat-warnings/Template.hs b/testsuite/tests/wcompat-warnings/Template.hs index 03f9a4957e..798eafc787 100644 --- a/testsuite/tests/wcompat-warnings/Template.hs +++ b/testsuite/tests/wcompat-warnings/Template.hs @@ -1,14 +1,9 @@ -{-# LANGUAGE NoMonadFailDesugaring, KindSignatures #-} +{-# LANGUAGE KindSignatures #-} module WCompatWarningsOnOff where import qualified Data.Semigroup as Semi -monadFail :: Monad m => m a -monadFail = do - Just _ <- undefined - undefined - (<>) = undefined -- Semigroup warnings -- -fwarn-noncanonical-monoid-instances diff --git a/testsuite/tests/wcompat-warnings/WCompatWarningsOn.stderr b/testsuite/tests/wcompat-warnings/WCompatWarningsOn.stderr index 3c3e73ddf6..b0d7bb2636 100644 --- a/testsuite/tests/wcompat-warnings/WCompatWarningsOn.stderr +++ b/testsuite/tests/wcompat-warnings/WCompatWarningsOn.stderr @@ -1,40 +1,19 @@ -Template.hs:9:5: warning: [-Wmissing-monadfail-instances (in -Wcompat)] - • Could not deduce (Control.Monad.Fail.MonadFail m) - arising from the failable pattern ‘Just _’ - (this will become an error in a future GHC release) - from the context: Monad m - bound by the type signature for: - monadFail :: forall (m :: * -> *) a. Monad m => m a - at Template.hs:7:1-27 - Possible fix: - add (Control.Monad.Fail.MonadFail m) to the context of - the type signature for: - monadFail :: forall (m :: * -> *) a. Monad m => m a - • In a stmt of a 'do' block: Just _ <- undefined - In the expression: - do Just _ <- undefined - undefined - In an equation for ‘monadFail’: - monadFail - = do Just _ <- undefined - undefined - -Template.hs:12:1: warning: [-Wsemigroup (in -Wcompat)] +Template.hs:7:1: warning: [-Wsemigroup (in -Wcompat)] Local definition of ‘<>’ clashes with a future Prelude name. This will become an error in a future release. -Template.hs:18:3: warning: [-Wnoncanonical-monoid-instances (in -Wcompat)] +Template.hs:13:3: warning: [-Wnoncanonical-monoid-instances (in -Wcompat)] Noncanonical ‘(<>) = mappend’ definition detected in the instance declaration for ‘Semigroup S’. Move definition from ‘mappend’ to ‘(<>)’ -Template.hs:21:3: warning: [-Wnoncanonical-monoid-instances (in -Wcompat)] +Template.hs:16:3: warning: [-Wnoncanonical-monoid-instances (in -Wcompat)] Noncanonical ‘mappend’ definition detected in the instance declaration for ‘Monoid S’. Define as ‘mappend = (<>)’ -Template.hs:25:15: warning: [-Wstar-is-type (in -Wcompat)] +Template.hs:20:15: warning: [-Wstar-is-type (in -Wcompat)] Using ‘*’ (or its Unicode variant) to mean ‘Data.Kind.Type’ relies on the StarIsType extension, which will become deprecated in the future. |