summaryrefslogtreecommitdiff
path: root/compiler/rename
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rename')
-rw-r--r--compiler/rename/RnExpr.hs17
-rw-r--r--compiler/rename/RnSource.hs43
2 files changed, 6 insertions, 54 deletions
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: