summaryrefslogtreecommitdiff
path: root/compiler/typecheck
diff options
context:
space:
mode:
authorHerbert Valerio Riedel <hvr@gnu.org>2017-09-09 16:29:23 +0200
committerHerbert Valerio Riedel <hvr@gnu.org>2017-09-09 16:43:36 +0200
commit346e562adffd44edd8c31328c0280543d7dd75c1 (patch)
treee10042e1640a8ad944c86d8590c45bb02254d2f6 /compiler/typecheck
parentdab0e515eadecaee3e9e9f5f8eee3159fa39bb27 (diff)
downloadhaskell-346e562adffd44edd8c31328c0280543d7dd75c1.tar.gz
Canonicalise MonoidFail instances in GHC
IOW, code compiles -Wnoncanonical-monoidfail-instances clean now This is easy now since we require GHC 8.0/base-4.9 or later for bootstrapping. Note that we can easily enable `MonadFail` via default-extensions: MonadFailDesugaring in compiler/ghc.cabal.in which currently would point out that NatM doesn't have a proper `fail` method, even though failable patterns are made use of: compiler/nativeGen/SPARC/CodeGen.hs:425:25: error: * No instance for (Control.Monad.Fail.MonadFail NatM) arising from a do statement with the failable pattern ‘(dyn_c, [dyn_r])’
Diffstat (limited to 'compiler/typecheck')
-rw-r--r--compiler/typecheck/TcRnTypes.hs2
-rw-r--r--compiler/typecheck/TcSMonad.hs2
2 files changed, 2 insertions, 2 deletions
diff --git a/compiler/typecheck/TcRnTypes.hs b/compiler/typecheck/TcRnTypes.hs
index 0eff63d8bd..0a76d23ad3 100644
--- a/compiler/typecheck/TcRnTypes.hs
+++ b/compiler/typecheck/TcRnTypes.hs
@@ -3513,7 +3513,7 @@ instance Applicative TcPluginM where
(<*>) = ap
instance Monad TcPluginM where
- fail x = TcPluginM (const $ fail x)
+ fail = MonadFail.fail
TcPluginM m >>= k =
TcPluginM (\ ev -> do a <- m ev
runTcPluginM (k a) ev)
diff --git a/compiler/typecheck/TcSMonad.hs b/compiler/typecheck/TcSMonad.hs
index c168c08a0f..932237c6c3 100644
--- a/compiler/typecheck/TcSMonad.hs
+++ b/compiler/typecheck/TcSMonad.hs
@@ -2291,7 +2291,7 @@ instance Applicative TcS where
(<*>) = ap
instance Monad TcS where
- fail err = TcS (\_ -> fail err)
+ fail = MonadFail.fail
m >>= k = TcS (\ebs -> unTcS m ebs >>= \r -> unTcS (k r) ebs)
instance MonadFail.MonadFail TcS where