summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler/basicTypes/UniqSupply.hs1
-rw-r--r--compiler/cmm/CmmLint.hs1
-rw-r--r--compiler/cmm/PprC.hs1
-rw-r--r--compiler/codeGen/StgCmmExtCode.hs1
-rw-r--r--compiler/codeGen/StgCmmMonad.hs4
-rw-r--r--compiler/coreSyn/CoreLint.hs1
-rw-r--r--compiler/deSugar/Coverage.hs1
-rw-r--r--compiler/ghci/ByteCodeAsm.hs1
-rw-r--r--compiler/ghci/ByteCodeGen.hs1
-rw-r--r--compiler/hsSyn/Convert.hs1
-rw-r--r--compiler/llvmGen/LlvmCodeGen/Base.hs1
-rw-r--r--compiler/main/CmdLineParser.hs2
-rw-r--r--compiler/main/GhcMonad.hs6
-rw-r--r--compiler/main/HscTypes.hs1
-rw-r--r--compiler/main/PipelineMonad.hs1
-rw-r--r--compiler/main/TidyPgm.hs1
-rw-r--r--compiler/nativeGen/AsmCodeGen.hs1
-rw-r--r--compiler/nativeGen/NCGMonad.hs1
-rw-r--r--compiler/nativeGen/RegAlloc/Linear/State.hs1
-rw-r--r--compiler/parser/Lexer.x1
-rw-r--r--compiler/prelude/PrelRules.hs1
-rw-r--r--compiler/profiling/SCCfinal.hs1
-rw-r--r--compiler/rename/RnPat.hs1
-rw-r--r--compiler/simplCore/CoreMonad.hs7
-rw-r--r--compiler/simplCore/SimplMonad.hs1
-rw-r--r--compiler/specialise/Specialise.hs1
-rw-r--r--compiler/stgSyn/CoreToStg.hs1
-rw-r--r--compiler/stgSyn/StgLint.hs1
-rw-r--r--compiler/typecheck/TcFlatten.hs1
-rw-r--r--compiler/typecheck/TcRnTypes.hs1
-rw-r--r--compiler/typecheck/TcSMonad.hs1
-rw-r--r--compiler/typecheck/TcTyDecls.hs1
-rw-r--r--compiler/typecheck/TcType.hs1
-rw-r--r--compiler/types/FamInstEnv.hs1
-rw-r--r--compiler/types/Type.hs4
-rw-r--r--compiler/types/Unify.hs2
-rw-r--r--compiler/utils/Exception.hs3
-rw-r--r--compiler/utils/IOEnv.hs1
-rw-r--r--compiler/utils/Maybes.hs2
-rw-r--r--compiler/utils/State.hs1
-rw-r--r--compiler/utils/Stream.hs1
-rw-r--r--compiler/vectorise/Vectorise/Monad/Base.hs1
-rw-r--r--libraries/ghci/GHCi/TH.hs1
-rw-r--r--libraries/template-haskell/Language/Haskell/TH/PprLib.hs1
-rw-r--r--libraries/template-haskell/Language/Haskell/TH/Syntax.hs3
-rw-r--r--utils/ghc-pkg/Main.hs1
46 files changed, 10 insertions, 60 deletions
diff --git a/compiler/basicTypes/UniqSupply.hs b/compiler/basicTypes/UniqSupply.hs
index 16734bc78f..e7e44cad9d 100644
--- a/compiler/basicTypes/UniqSupply.hs
+++ b/compiler/basicTypes/UniqSupply.hs
@@ -127,7 +127,6 @@ splitUniqSupply4 us = (us1, us2, us3, us4)
newtype UniqSM result = USM { unUSM :: UniqSupply -> (# result, UniqSupply #) }
instance Monad UniqSM where
- return = pure
(>>=) = thenUs
(>>) = (*>)
diff --git a/compiler/cmm/CmmLint.hs b/compiler/cmm/CmmLint.hs
index 3f85053514..015337bdad 100644
--- a/compiler/cmm/CmmLint.hs
+++ b/compiler/cmm/CmmLint.hs
@@ -222,7 +222,6 @@ instance Monad CmmLint where
case m dflags of
Left e -> Left e
Right a -> unCL (k a) dflags
- return = pure
instance HasDynFlags CmmLint where
getDynFlags = CmmLint (\dflags -> Right dflags)
diff --git a/compiler/cmm/PprC.hs b/compiler/cmm/PprC.hs
index af24b17a6f..3d3acec47d 100644
--- a/compiler/cmm/PprC.hs
+++ b/compiler/cmm/PprC.hs
@@ -1008,7 +1008,6 @@ instance Applicative TE where
instance Monad TE where
TE m >>= k = TE $ \s -> case m s of (a, s') -> unTE (k a) s'
- return = pure
te_lbl :: CLabel -> TE ()
te_lbl lbl = TE $ \(temps,lbls) -> ((), (temps, Map.insert lbl () lbls))
diff --git a/compiler/codeGen/StgCmmExtCode.hs b/compiler/codeGen/StgCmmExtCode.hs
index db03a3883b..f3bb6ee5b8 100644
--- a/compiler/codeGen/StgCmmExtCode.hs
+++ b/compiler/codeGen/StgCmmExtCode.hs
@@ -89,7 +89,6 @@ instance Applicative CmmParse where
instance Monad CmmParse where
(>>=) = thenExtFC
- return = pure
instance HasDynFlags CmmParse where
getDynFlags = EC (\_ _ d -> do dflags <- getDynFlags
diff --git a/compiler/codeGen/StgCmmMonad.hs b/compiler/codeGen/StgCmmMonad.hs
index dd82b7f941..6611b2944e 100644
--- a/compiler/codeGen/StgCmmMonad.hs
+++ b/compiler/codeGen/StgCmmMonad.hs
@@ -77,7 +77,6 @@ import UniqSupply
import FastString
import Outputable
-import qualified Control.Applicative as A
import Control.Monad
import Data.List
import Prelude hiding( sequence, succ )
@@ -117,13 +116,12 @@ newtype FCode a = FCode (CgInfoDownwards -> CgState -> (# a, CgState #))
instance Functor FCode where
fmap f (FCode g) = FCode $ \i s -> case g i s of (# a, s' #) -> (# f a, s' #)
-instance A.Applicative FCode where
+instance Applicative FCode where
pure = returnFC
(<*>) = ap
instance Monad FCode where
(>>=) = thenFC
- return = A.pure
{-# INLINE thenC #-}
{-# INLINE thenFC #-}
diff --git a/compiler/coreSyn/CoreLint.hs b/compiler/coreSyn/CoreLint.hs
index 0030e3c433..2f6ab1cb9b 100644
--- a/compiler/coreSyn/CoreLint.hs
+++ b/compiler/coreSyn/CoreLint.hs
@@ -1576,7 +1576,6 @@ instance Applicative LintM where
(<*>) = ap
instance Monad LintM where
- return = pure
fail err = failWithL (text err)
m >>= k = LintM (\ env errs ->
let (res, errs') = unLintM m env errs in
diff --git a/compiler/deSugar/Coverage.hs b/compiler/deSugar/Coverage.hs
index 2711925161..08014229e9 100644
--- a/compiler/deSugar/Coverage.hs
+++ b/compiler/deSugar/Coverage.hs
@@ -1055,7 +1055,6 @@ instance Applicative TM where
(<*>) = ap
instance Monad TM where
- return = pure
(TM m) >>= k = TM $ \ env st ->
case m env st of
(r1,fv1,st1) ->
diff --git a/compiler/ghci/ByteCodeAsm.hs b/compiler/ghci/ByteCodeAsm.hs
index cfb78fbd47..41450530fd 100644
--- a/compiler/ghci/ByteCodeAsm.hs
+++ b/compiler/ghci/ByteCodeAsm.hs
@@ -170,7 +170,6 @@ instance Applicative Assembler where
(<*>) = ap
instance Monad Assembler where
- return = pure
NullAsm x >>= f = f x
AllocPtr p k >>= f = AllocPtr p (k >=> f)
AllocLit l k >>= f = AllocLit l (k >=> f)
diff --git a/compiler/ghci/ByteCodeGen.hs b/compiler/ghci/ByteCodeGen.hs
index d9a504b649..4311fcddea 100644
--- a/compiler/ghci/ByteCodeGen.hs
+++ b/compiler/ghci/ByteCodeGen.hs
@@ -1684,7 +1684,6 @@ instance Applicative BcM where
instance Monad BcM where
(>>=) = thenBc
(>>) = (*>)
- return = pure
instance HasDynFlags BcM where
getDynFlags = BcM $ \st -> return (st, hsc_dflags (bcm_hsc_env st))
diff --git a/compiler/hsSyn/Convert.hs b/compiler/hsSyn/Convert.hs
index 9b904514a1..b28432f3d8 100644
--- a/compiler/hsSyn/Convert.hs
+++ b/compiler/hsSyn/Convert.hs
@@ -87,7 +87,6 @@ instance Applicative CvtM where
(<*>) = ap
instance Monad CvtM where
- return = pure
(CvtM m) >>= k = CvtM $ \loc -> case m loc of
Left err -> Left err
Right (loc',v) -> unCvtM (k v) loc'
diff --git a/compiler/llvmGen/LlvmCodeGen/Base.hs b/compiler/llvmGen/LlvmCodeGen/Base.hs
index ac352ff9a4..3a60891810 100644
--- a/compiler/llvmGen/LlvmCodeGen/Base.hs
+++ b/compiler/llvmGen/LlvmCodeGen/Base.hs
@@ -218,7 +218,6 @@ instance Applicative LlvmM where
(<*>) = ap
instance Monad LlvmM where
- return = pure
m >>= f = LlvmM $ \env -> do (x, env') <- runLlvmM m env
runLlvmM (f x) env'
diff --git a/compiler/main/CmdLineParser.hs b/compiler/main/CmdLineParser.hs
index 83ac593935..0a24be5579 100644
--- a/compiler/main/CmdLineParser.hs
+++ b/compiler/main/CmdLineParser.hs
@@ -103,7 +103,6 @@ instance Monad m => Applicative (EwM m) where
instance Monad m => Monad (EwM m) where
(EwM f) >>= k = EwM (\l e w -> do (e', w', r) <- f l e w
unEwM (k r) l e' w')
- return = pure
runEwM :: EwM m a -> m (Errs, Warns, a)
runEwM action = unEwM action (panic "processArgs: no arg yet") emptyBag emptyBag
@@ -151,7 +150,6 @@ instance Monad (CmdLineP s) where
let (a, s') = runCmdLine m s
in runCmdLine (k a) s'
- return = pure
getCmdLineState :: CmdLineP s s
getCmdLineState = CmdLineP $ \s -> (s,s)
diff --git a/compiler/main/GhcMonad.hs b/compiler/main/GhcMonad.hs
index c28e87753d..2673dd8e45 100644
--- a/compiler/main/GhcMonad.hs
+++ b/compiler/main/GhcMonad.hs
@@ -104,7 +104,6 @@ instance Applicative Ghc where
g <*> m = do f <- g; a <- m; return (f a)
instance Monad Ghc where
- return = pure
m >>= g = Ghc $ \s -> do a <- unGhc m s; unGhc (g a) s
instance MonadIO Ghc where
@@ -168,11 +167,10 @@ instance Applicative m => Applicative (GhcT m) where
pure x = GhcT $ \_ -> pure x
g <*> m = GhcT $ \s -> unGhcT g s <*> unGhcT m s
-instance (Applicative m, Monad m) => Monad (GhcT m) where
- return = pure
+instance Monad m => Monad (GhcT m) where
m >>= k = GhcT $ \s -> do a <- unGhcT m s; unGhcT (k a) s
-instance (Applicative m, MonadIO m) => MonadIO (GhcT m) where
+instance MonadIO m => MonadIO (GhcT m) where
liftIO ioA = GhcT $ \_ -> liftIO ioA
instance ExceptionMonad m => ExceptionMonad (GhcT m) where
diff --git a/compiler/main/HscTypes.hs b/compiler/main/HscTypes.hs
index ea921fe79a..0a7682157e 100644
--- a/compiler/main/HscTypes.hs
+++ b/compiler/main/HscTypes.hs
@@ -228,7 +228,6 @@ instance Applicative Hsc where
(<*>) = ap
instance Monad Hsc where
- return = pure
Hsc m >>= k = Hsc $ \e w -> do (a, w1) <- m e w
case k a of
Hsc k' -> k' e w1
diff --git a/compiler/main/PipelineMonad.hs b/compiler/main/PipelineMonad.hs
index 6b20db719d..614c4fa30f 100644
--- a/compiler/main/PipelineMonad.hs
+++ b/compiler/main/PipelineMonad.hs
@@ -31,7 +31,6 @@ instance Applicative CompPipeline where
(<*>) = ap
instance Monad CompPipeline where
- return = pure
P m >>= k = P $ \env state -> do (state',a) <- m env state
unP (k a) env state'
diff --git a/compiler/main/TidyPgm.hs b/compiler/main/TidyPgm.hs
index 122440133f..8a27fd7b6e 100644
--- a/compiler/main/TidyPgm.hs
+++ b/compiler/main/TidyPgm.hs
@@ -775,7 +775,6 @@ instance Applicative DFFV where
(<*>) = ap
instance Monad DFFV where
- return = pure
(DFFV m) >>= k = DFFV $ \env st ->
case m env st of
(st',a) -> case k a of
diff --git a/compiler/nativeGen/AsmCodeGen.hs b/compiler/nativeGen/AsmCodeGen.hs
index 7d3f98be85..fc18c6bbe1 100644
--- a/compiler/nativeGen/AsmCodeGen.hs
+++ b/compiler/nativeGen/AsmCodeGen.hs
@@ -983,7 +983,6 @@ instance Applicative CmmOptM where
(<*>) = ap
instance Monad CmmOptM where
- return = pure
(CmmOptM f) >>= g =
CmmOptM $ \dflags this_mod imports ->
case f dflags this_mod imports of
diff --git a/compiler/nativeGen/NCGMonad.hs b/compiler/nativeGen/NCGMonad.hs
index 1dde1bc0f7..43547d0515 100644
--- a/compiler/nativeGen/NCGMonad.hs
+++ b/compiler/nativeGen/NCGMonad.hs
@@ -94,7 +94,6 @@ instance Applicative NatM where
instance Monad NatM where
(>>=) = thenNat
- return = pure
thenNat :: NatM a -> (a -> NatM b) -> NatM b
diff --git a/compiler/nativeGen/RegAlloc/Linear/State.hs b/compiler/nativeGen/RegAlloc/Linear/State.hs
index e407a80fe1..8b17d3ab88 100644
--- a/compiler/nativeGen/RegAlloc/Linear/State.hs
+++ b/compiler/nativeGen/RegAlloc/Linear/State.hs
@@ -57,7 +57,6 @@ instance Applicative (RegM freeRegs) where
instance Monad (RegM freeRegs) where
m >>= k = RegM $ \s -> case unReg m s of { (# s, a #) -> unReg (k a) s }
- return = pure
instance HasDynFlags (RegM a) where
getDynFlags = RegM $ \s -> (# s, ra_DynFlags s #)
diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x
index 26809db5ad..0f6becb9f6 100644
--- a/compiler/parser/Lexer.x
+++ b/compiler/parser/Lexer.x
@@ -1783,7 +1783,6 @@ instance Applicative P where
(<*>) = ap
instance Monad P where
- return = pure
(>>=) = thenP
fail = failP
diff --git a/compiler/prelude/PrelRules.hs b/compiler/prelude/PrelRules.hs
index 49cfa982fb..2a174b13fc 100644
--- a/compiler/prelude/PrelRules.hs
+++ b/compiler/prelude/PrelRules.hs
@@ -645,7 +645,6 @@ instance Applicative RuleM where
(<*>) = ap
instance Monad RuleM where
- return = pure
RuleM f >>= g = RuleM $ \dflags iu e -> case f dflags iu e of
Nothing -> Nothing
Just r -> runRuleM (g r) dflags iu e
diff --git a/compiler/profiling/SCCfinal.hs b/compiler/profiling/SCCfinal.hs
index 69ebb59c1b..6cab87c9cd 100644
--- a/compiler/profiling/SCCfinal.hs
+++ b/compiler/profiling/SCCfinal.hs
@@ -233,7 +233,6 @@ instance Applicative MassageM where
(*>) = thenMM_
instance Monad MassageM where
- return = pure
(>>=) = thenMM
(>>) = (*>)
diff --git a/compiler/rename/RnPat.hs b/compiler/rename/RnPat.hs
index 8ee214193c..3b526d128a 100644
--- a/compiler/rename/RnPat.hs
+++ b/compiler/rename/RnPat.hs
@@ -107,7 +107,6 @@ instance Applicative CpsRn where
(<*>) = ap
instance Monad CpsRn where
- return = pure
(CpsRn m) >>= mk = CpsRn (\k -> m (\v -> unCpsRn (mk v) k))
runCps :: CpsRn a -> RnM (a, FreeVars)
diff --git a/compiler/simplCore/CoreMonad.hs b/compiler/simplCore/CoreMonad.hs
index 5e2de54180..4958474a9d 100644
--- a/compiler/simplCore/CoreMonad.hs
+++ b/compiler/simplCore/CoreMonad.hs
@@ -88,8 +88,8 @@ import Data.IORef
import Data.Map (Map)
import qualified Data.Map as Map
import Data.Word
-import qualified Control.Applicative as A
import Control.Monad
+import Control.Applicative ( Alternative(..) )
import Prelude hiding ( read )
@@ -557,7 +557,6 @@ instance Functor CoreM where
fmap = liftM
instance Monad CoreM where
- return = pure
mx >>= f = CoreM $ \s -> do
(x, s', w1) <- unCoreM mx s
(y, s'', w2) <- unCoreM (f x) s'
@@ -566,12 +565,12 @@ instance Monad CoreM where
-- forcing w before building the tuple avoids a space leak
-- (Trac #7702)
-instance A.Applicative CoreM where
+instance Applicative CoreM where
pure x = CoreM $ \s -> nop s x
(<*>) = ap
m *> k = m >>= \_ -> k
-instance MonadPlus IO => A.Alternative CoreM where
+instance MonadPlus IO => Alternative CoreM where
empty = mzero
(<|>) = mplus
diff --git a/compiler/simplCore/SimplMonad.hs b/compiler/simplCore/SimplMonad.hs
index 8835494d64..f165c65db5 100644
--- a/compiler/simplCore/SimplMonad.hs
+++ b/compiler/simplCore/SimplMonad.hs
@@ -109,7 +109,6 @@ instance Applicative SimplM where
instance Monad SimplM where
(>>) = (*>)
(>>=) = thenSmpl
- return = pure
returnSmpl :: a -> SimplM a
returnSmpl e = SM (\_st_env us sc -> return (e, us, sc))
diff --git a/compiler/specialise/Specialise.hs b/compiler/specialise/Specialise.hs
index 7a3257e79c..1507510b0d 100644
--- a/compiler/specialise/Specialise.hs
+++ b/compiler/specialise/Specialise.hs
@@ -2091,7 +2091,6 @@ instance Monad SpecM where
case f y of
SpecM z ->
z
- return = pure
fail str = SpecM $ fail str
#if __GLASGOW_HASKELL__ > 710
diff --git a/compiler/stgSyn/CoreToStg.hs b/compiler/stgSyn/CoreToStg.hs
index e5954ab440..54d20b3d05 100644
--- a/compiler/stgSyn/CoreToStg.hs
+++ b/compiler/stgSyn/CoreToStg.hs
@@ -994,7 +994,6 @@ instance Applicative LneM where
(<*>) = ap
instance Monad LneM where
- return = pure
(>>=) = thenLne
instance MonadFix LneM where
diff --git a/compiler/stgSyn/StgLint.hs b/compiler/stgSyn/StgLint.hs
index e8bfe113b6..7aa07b25d3 100644
--- a/compiler/stgSyn/StgLint.hs
+++ b/compiler/stgSyn/StgLint.hs
@@ -315,7 +315,6 @@ instance Applicative LintM where
(*>) = thenL_
instance Monad LintM where
- return = pure
(>>=) = thenL
(>>) = (*>)
diff --git a/compiler/typecheck/TcFlatten.hs b/compiler/typecheck/TcFlatten.hs
index 281da4049b..20f77a7650 100644
--- a/compiler/typecheck/TcFlatten.hs
+++ b/compiler/typecheck/TcFlatten.hs
@@ -526,7 +526,6 @@ newtype FlatM a
= FlatM { runFlatM :: FlattenEnv -> TcS a }
instance Monad FlatM where
- return = pure
m >>= k = FlatM $ \env ->
do { a <- runFlatM m env
; runFlatM (k a) env }
diff --git a/compiler/typecheck/TcRnTypes.hs b/compiler/typecheck/TcRnTypes.hs
index d0cf737058..457e6f8426 100644
--- a/compiler/typecheck/TcRnTypes.hs
+++ b/compiler/typecheck/TcRnTypes.hs
@@ -2903,7 +2903,6 @@ instance Applicative TcPluginM where
(<*>) = ap
instance Monad TcPluginM where
- return = pure
fail x = TcPluginM (const $ fail x)
TcPluginM m >>= k =
TcPluginM (\ ev -> do a <- m ev
diff --git a/compiler/typecheck/TcSMonad.hs b/compiler/typecheck/TcSMonad.hs
index ac38e171b8..c508bb1e08 100644
--- a/compiler/typecheck/TcSMonad.hs
+++ b/compiler/typecheck/TcSMonad.hs
@@ -2246,7 +2246,6 @@ instance Applicative TcS where
(<*>) = ap
instance Monad TcS where
- return = pure
fail err = TcS (\_ -> fail err)
m >>= k = TcS (\ebs -> unTcS m ebs >>= \r -> unTcS (k r) ebs)
diff --git a/compiler/typecheck/TcTyDecls.hs b/compiler/typecheck/TcTyDecls.hs
index c17d78b9cc..47f5b64d10 100644
--- a/compiler/typecheck/TcTyDecls.hs
+++ b/compiler/typecheck/TcTyDecls.hs
@@ -788,7 +788,6 @@ instance Applicative RoleM where
(<*>) = ap
instance Monad RoleM where
- return = pure
a >>= f = RM $ \m_info vps nvps state ->
let (a', state') = unRM a m_info vps nvps state in
unRM (f a') m_info vps nvps state'
diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs
index 8e8f3375f3..fca5f475a3 100644
--- a/compiler/typecheck/TcType.hs
+++ b/compiler/typecheck/TcType.hs
@@ -1433,7 +1433,6 @@ instance Applicative OccCheckResult where
(<*>) = ap
instance Monad OccCheckResult where
- return = pure
OC_OK x >>= k = k x
OC_Forall >>= _ = OC_Forall
OC_NonTyVar >>= _ = OC_NonTyVar
diff --git a/compiler/types/FamInstEnv.hs b/compiler/types/FamInstEnv.hs
index 00a128d026..16c176d28e 100644
--- a/compiler/types/FamInstEnv.hs
+++ b/compiler/types/FamInstEnv.hs
@@ -1378,7 +1378,6 @@ withLC :: LiftingContext -> NormM a -> NormM a
withLC lc thing = NormM $ \ envs _old_lc r -> runNormM thing envs lc r
instance Monad NormM where
- return = pure
ma >>= fmb = NormM $ \env lc r ->
let a = runNormM ma env lc r in
runNormM (fmb a) env lc r
diff --git a/compiler/types/Type.hs b/compiler/types/Type.hs
index cd2b5873c6..6a86f70885 100644
--- a/compiler/types/Type.hs
+++ b/compiler/types/Type.hs
@@ -437,7 +437,7 @@ data TyCoMapper env m
}
{-# INLINABLE mapType #-} -- See Note [Specialising mappers]
-mapType :: (Applicative m, Monad m) => TyCoMapper env m -> env -> Type -> m Type
+mapType :: Monad m => TyCoMapper env m -> env -> Type -> m Type
mapType mapper@(TyCoMapper { tcm_smart = smart, tcm_tyvar = tyvar
, tcm_tybinder = tybinder })
env ty
@@ -460,7 +460,7 @@ mapType mapper@(TyCoMapper { tcm_smart = smart, tcm_tyvar = tyvar
| otherwise = (TyConApp, AppTy, CastTy, ForAllTy . Anon)
{-# INLINABLE mapCoercion #-} -- See Note [Specialising mappers]
-mapCoercion :: (Applicative m, Monad m)
+mapCoercion :: Monad m
=> TyCoMapper env m -> env -> Coercion -> m Coercion
mapCoercion mapper@(TyCoMapper { tcm_smart = smart, tcm_covar = covar
, tcm_hole = cohole, tcm_tybinder = tybinder })
diff --git a/compiler/types/Unify.hs b/compiler/types/Unify.hs
index 769f505ee0..c4c95bfd73 100644
--- a/compiler/types/Unify.hs
+++ b/compiler/types/Unify.hs
@@ -374,7 +374,6 @@ instance Applicative UnifyResultM where
(<*>) = ap
instance Monad UnifyResultM where
- return = pure
SurelyApart >>= _ = SurelyApart
MaybeApart x >>= f = case f x of
@@ -908,7 +907,6 @@ instance Applicative UM where
(<*>) = ap
instance Monad UM where
- return = pure
fail _ = UM (\_ _ -> SurelyApart) -- failed pattern match
m >>= k = UM (\env state ->
do { (state', v) <- unUM m env state
diff --git a/compiler/utils/Exception.hs b/compiler/utils/Exception.hs
index 8168992e00..850393e359 100644
--- a/compiler/utils/Exception.hs
+++ b/compiler/utils/Exception.hs
@@ -6,7 +6,6 @@ module Exception
)
where
-import Control.Applicative as A
import Control.Exception
import Control.Monad.IO.Class
@@ -29,7 +28,7 @@ tryIO = try
-- implementations of 'gbracket' and 'gfinally' use 'gmask'
-- thus rarely require overriding.
--
-class (A.Applicative m, MonadIO m) => ExceptionMonad m where
+class MonadIO m => ExceptionMonad m where
-- | Generalised version of 'Control.Exception.catch', allowing an arbitrary
-- exception handling monad instead of just 'IO'.
diff --git a/compiler/utils/IOEnv.hs b/compiler/utils/IOEnv.hs
index 804ddd8e70..4470420a64 100644
--- a/compiler/utils/IOEnv.hs
+++ b/compiler/utils/IOEnv.hs
@@ -62,7 +62,6 @@ unIOEnv (IOEnv m) = m
instance Monad (IOEnv m) where
(>>=) = thenM
(>>) = (*>)
- return = pure
fail _ = failM -- Ignore the string
#if __GLASGOW_HASKELL__ > 710
diff --git a/compiler/utils/Maybes.hs b/compiler/utils/Maybes.hs
index ac5107029b..83dc9b6864 100644
--- a/compiler/utils/Maybes.hs
+++ b/compiler/utils/Maybes.hs
@@ -17,7 +17,6 @@ module Maybes (
MaybeT(..), liftMaybeT
) where
-import Control.Applicative as A
import Control.Monad
import Control.Monad.Trans.Maybe
import Data.Maybe
@@ -84,7 +83,6 @@ instance Applicative (MaybeErr err) where
(<*>) = ap
instance Monad (MaybeErr err) where
- return = A.pure
Succeeded v >>= k = k v
Failed e >>= _ = Failed e
diff --git a/compiler/utils/State.hs b/compiler/utils/State.hs
index fb6f2c3554..8eca4657df 100644
--- a/compiler/utils/State.hs
+++ b/compiler/utils/State.hs
@@ -15,7 +15,6 @@ instance Applicative (State s) where
(# x, s'' #) -> (# f x, s'' #)
instance Monad (State s) where
- return = pure
m >>= n = State $ \s -> case runState' m s of
(# r, s' #) -> runState' (n r) s'
diff --git a/compiler/utils/Stream.hs b/compiler/utils/Stream.hs
index a347206e61..f7b21017cf 100644
--- a/compiler/utils/Stream.hs
+++ b/compiler/utils/Stream.hs
@@ -46,7 +46,6 @@ instance Monad m => Applicative (Stream m a) where
(<*>) = ap
instance Monad m => Monad (Stream m a) where
- return = pure
Stream m >>= k = Stream $ do
r <- m
diff --git a/compiler/vectorise/Vectorise/Monad/Base.hs b/compiler/vectorise/Vectorise/Monad/Base.hs
index da53e8b94d..b084da67dc 100644
--- a/compiler/vectorise/Vectorise/Monad/Base.hs
+++ b/compiler/vectorise/Vectorise/Monad/Base.hs
@@ -51,7 +51,6 @@ newtype VM a
= VM { runVM :: Builtins -> GlobalEnv -> LocalEnv -> DsM (VResult a) }
instance Monad VM where
- return = pure
VM p >>= f = VM $ \bi genv lenv -> do
r <- p bi genv lenv
case r of
diff --git a/libraries/ghci/GHCi/TH.hs b/libraries/ghci/GHCi/TH.hs
index f379dbc546..717192e39d 100644
--- a/libraries/ghci/GHCi/TH.hs
+++ b/libraries/ghci/GHCi/TH.hs
@@ -72,7 +72,6 @@ instance Monad GHCiQ where
do (m', s') <- runGHCiQ m s
(a, s'') <- runGHCiQ (f m') s'
return (a, s'')
- return = pure
fail err = GHCiQ $ \s -> throwIO (GHCiQException s err)
getState :: GHCiQ QState
diff --git a/libraries/template-haskell/Language/Haskell/TH/PprLib.hs b/libraries/template-haskell/Language/Haskell/TH/PprLib.hs
index 594d7dc54d..378888d77f 100644
--- a/libraries/template-haskell/Language/Haskell/TH/PprLib.hs
+++ b/libraries/template-haskell/Language/Haskell/TH/PprLib.hs
@@ -155,7 +155,6 @@ instance Applicative PprM where
(<*>) = ap
instance Monad PprM where
- return = pure
m >>= k = PprM $ \s -> let (x, s') = runPprM m s
in runPprM (k x) s'
diff --git a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
index becbbd6d7a..269bb70753 100644
--- a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
+++ b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
@@ -52,7 +52,7 @@ import Numeric.Natural
--
-----------------------------------------------------
-class (Applicative m, Monad m) => Quasi m where
+class Monad m => Quasi m where
qNewName :: String -> m Name
-- ^ Fresh names
@@ -170,7 +170,6 @@ runQ (Q m) = m
instance Monad Q where
Q m >>= k = Q (m >>= \x -> unQ (k x))
(>>) = (*>)
- return = pure
fail s = report True s >> Q (fail "Q monad failure")
instance Functor Q where
diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs
index eb8e311fb6..4a3fbdb294 100644
--- a/utils/ghc-pkg/Main.hs
+++ b/utils/ghc-pkg/Main.hs
@@ -1517,7 +1517,6 @@ instance Applicative Validate where
(<*>) = ap
instance Monad Validate where
- return = pure
m >>= k = V $ do
(a, es, ws) <- runValidate m
(b, es', ws') <- runValidate (k a)