summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorHerbert Valerio Riedel <hvr@gnu.org>2018-12-18 23:36:29 +0100
committerHerbert Valerio Riedel <hvr@gnu.org>2019-01-18 17:01:56 -0500
commitc9756dbf1ee58b117ea5c4ded45dea88030efd65 (patch)
tree66aa32d9fdc0303c3b15f3fdb9605e30d8aa2449 /compiler
parentb14f54041eacf8c0f85e756148042d2dca8333f9 (diff)
downloadhaskell-c9756dbf1ee58b117ea5c4ded45dea88030efd65.tar.gz
Prepare source-tree for base-4.13 MFP bump
Diffstat (limited to 'compiler')
-rw-r--r--compiler/basicTypes/UniqSupply.hs4
-rw-r--r--compiler/cmm/CmmMonad.hs4
-rw-r--r--compiler/coreSyn/CoreLint.hs2
-rw-r--r--compiler/coreSyn/MkCore.hs4
-rw-r--r--compiler/ghc.cabal.in2
-rw-r--r--compiler/llvmGen/LlvmCodeGen/CodeGen.hs4
-rw-r--r--compiler/main/GHC.hs2
-rw-r--r--compiler/parser/Lexer.x5
-rw-r--r--compiler/prelude/PrelRules.hs2
-rw-r--r--compiler/specialise/Specialise.hs4
-rw-r--r--compiler/typecheck/TcRnTypes.hs2
-rw-r--r--compiler/typecheck/TcSMonad.hs2
-rw-r--r--compiler/types/Unify.hs2
-rw-r--r--compiler/utils/IOEnv.hs3
-rw-r--r--compiler/utils/ListT.hs5
15 files changed, 36 insertions, 11 deletions
diff --git a/compiler/basicTypes/UniqSupply.hs b/compiler/basicTypes/UniqSupply.hs
index 664600147e..d1ea7e953d 100644
--- a/compiler/basicTypes/UniqSupply.hs
+++ b/compiler/basicTypes/UniqSupply.hs
@@ -40,7 +40,7 @@ import MonadUtils
import Control.Monad
import Data.Bits
import Data.Char
-import Control.Monad.Fail
+import Control.Monad.Fail as Fail
#include "Unique.h"
@@ -150,7 +150,7 @@ instance Applicative UniqSM where
(*>) = thenUs_
-- TODO: try to get rid of this instance
-instance MonadFail UniqSM where
+instance Fail.MonadFail UniqSM where
fail = panic
-- | Run the 'UniqSM' action, returning the final 'UniqSupply'
diff --git a/compiler/cmm/CmmMonad.hs b/compiler/cmm/CmmMonad.hs
index f3b4441a9b..821c0a6504 100644
--- a/compiler/cmm/CmmMonad.hs
+++ b/compiler/cmm/CmmMonad.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE CPP #-}
+
-----------------------------------------------------------------------------
-- A Parser monad with access to the 'DynFlags'.
--
@@ -31,7 +33,9 @@ instance Applicative PD where
instance Monad PD where
(>>=) = thenPD
+#if !MIN_VERSION_base(4,13,0)
fail = MonadFail.fail
+#endif
instance MonadFail.MonadFail PD where
fail = failPD
diff --git a/compiler/coreSyn/CoreLint.hs b/compiler/coreSyn/CoreLint.hs
index b1b37c51be..53cddbfabe 100644
--- a/compiler/coreSyn/CoreLint.hs
+++ b/compiler/coreSyn/CoreLint.hs
@@ -2160,7 +2160,9 @@ instance Applicative LintM where
(<*>) = ap
instance Monad LintM where
+#if !MIN_VERSION_base(4,13,0)
fail = MonadFail.fail
+#endif
m >>= k = LintM (\ env errs ->
let (res, errs') = unLintM m env errs in
case res of
diff --git a/compiler/coreSyn/MkCore.hs b/compiler/coreSyn/MkCore.hs
index 4fa824a7dc..1d07399293 100644
--- a/compiler/coreSyn/MkCore.hs
+++ b/compiler/coreSyn/MkCore.hs
@@ -81,7 +81,7 @@ import DynFlags
import Data.List
import Data.Char ( ord )
-import Control.Monad.Fail ( MonadFail )
+import Control.Monad.Fail as MonadFail ( MonadFail )
infixl 4 `mkCoreApp`, `mkCoreApps`
@@ -600,7 +600,7 @@ mkFoldrExpr elt_ty result_ty c n list = do
`App` list)
-- | Make a 'build' expression applied to a locally-bound worker function
-mkBuildExpr :: (MonadFail m, MonadThings m, MonadUnique m)
+mkBuildExpr :: (MonadFail.MonadFail m, MonadThings m, MonadUnique m)
=> Type -- ^ Type of list elements to be built
-> ((Id, Type) -> (Id, Type) -> m CoreExpr) -- ^ Function that, given information about the 'Id's
-- of the binders for the build worker function, returns
diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in
index 4be4d60cb7..a02ce1297d 100644
--- a/compiler/ghc.cabal.in
+++ b/compiler/ghc.cabal.in
@@ -59,7 +59,7 @@ Library
Default-Language: Haskell2010
Exposed: False
- Build-Depends: base >= 4.9 && < 5,
+ Build-Depends: base >= 4.11 && < 4.14,
deepseq >= 1.4 && < 1.5,
directory >= 1 && < 1.4,
process >= 1 && < 1.7,
diff --git a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs
index 6071bd82e5..f6b47b091c 100644
--- a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs
+++ b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs
@@ -1658,7 +1658,7 @@ getCmmReg (CmmLocal (LocalReg un _))
dflags <- getDynFlags
case exists of
Just ety -> return (LMLocalVar un $ pLift ety)
- Nothing -> fail $ "getCmmReg: Cmm register " ++ showSDoc dflags (ppr un) ++ " was not allocated!"
+ Nothing -> panic $ "getCmmReg: Cmm register " ++ showSDoc dflags (ppr un) ++ " was not allocated!"
-- This should never happen, as every local variable should
-- have been assigned a value at some point, triggering
-- "funPrologue" to allocate it on the stack.
@@ -1668,7 +1668,7 @@ getCmmReg (CmmGlobal g)
dflags <- getDynFlags
if onStack
then return (lmGlobalRegVar dflags g)
- else fail $ "getCmmReg: Cmm register " ++ showSDoc dflags (ppr g) ++ " not stack-allocated!"
+ else panic $ "getCmmReg: Cmm register " ++ showSDoc dflags (ppr g) ++ " not stack-allocated!"
-- | Return the value of a given register, as well as its type. Might
-- need to be load from stack.
diff --git a/compiler/main/GHC.hs b/compiler/main/GHC.hs
index f289cd4229..471a558cc6 100644
--- a/compiler/main/GHC.hs
+++ b/compiler/main/GHC.hs
@@ -522,7 +522,7 @@ checkBrokenTablesNextToCode dflags
= do { broken <- checkBrokenTablesNextToCode' dflags
; when broken
$ do { _ <- liftIO $ throwIO $ mkApiErr dflags invalidLdErr
- ; fail "unsupported linker"
+ ; liftIO $ fail "unsupported linker"
}
}
where
diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x
index c64c0173e8..c4d0d4d127 100644
--- a/compiler/parser/Lexer.x
+++ b/compiler/parser/Lexer.x
@@ -41,6 +41,7 @@
-- Alex "Haskell code fragment top"
{
+{-# LANGUAGE CPP #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE LambdaCase #-}
@@ -2015,9 +2016,11 @@ instance Applicative P where
instance Monad P where
(>>=) = thenP
+#if !MIN_VERSION_base(4,13,0)
fail = MonadFail.fail
+#endif
-instance MonadFail P where
+instance MonadFail.MonadFail P where
fail = failP
returnP :: a -> P a
diff --git a/compiler/prelude/PrelRules.hs b/compiler/prelude/PrelRules.hs
index cd04074545..f8b8f91bcc 100644
--- a/compiler/prelude/PrelRules.hs
+++ b/compiler/prelude/PrelRules.hs
@@ -749,7 +749,9 @@ instance Monad RuleM where
RuleM f >>= g = RuleM $ \dflags iu e -> case f dflags iu e of
Nothing -> Nothing
Just r -> runRuleM (g r) dflags iu e
+#if !MIN_VERSION_base(4,13,0)
fail = MonadFail.fail
+#endif
instance MonadFail.MonadFail RuleM where
fail _ = mzero
diff --git a/compiler/specialise/Specialise.hs b/compiler/specialise/Specialise.hs
index d5e64e3dc0..f391781c43 100644
--- a/compiler/specialise/Specialise.hs
+++ b/compiler/specialise/Specialise.hs
@@ -2287,10 +2287,12 @@ instance Monad SpecM where
case f y of
SpecM z ->
z
+#if !MIN_VERSION_base(4,13,0)
fail = MonadFail.fail
+#endif
instance MonadFail.MonadFail SpecM where
- fail str = SpecM $ fail str
+ fail str = SpecM $ error str
instance MonadUnique SpecM where
getUniqueSupplyM
diff --git a/compiler/typecheck/TcRnTypes.hs b/compiler/typecheck/TcRnTypes.hs
index 205a2bda03..b9e5b6ca8f 100644
--- a/compiler/typecheck/TcRnTypes.hs
+++ b/compiler/typecheck/TcRnTypes.hs
@@ -3844,7 +3844,9 @@ instance Applicative TcPluginM where
(<*>) = ap
instance Monad TcPluginM where
+#if !MIN_VERSION_base(4,13,0)
fail = MonadFail.fail
+#endif
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 69f58b9002..a845623aaa 100644
--- a/compiler/typecheck/TcSMonad.hs
+++ b/compiler/typecheck/TcSMonad.hs
@@ -2611,7 +2611,9 @@ instance Applicative TcS where
(<*>) = ap
instance Monad TcS where
+#if !MIN_VERSION_base(4,13,0)
fail = MonadFail.fail
+#endif
m >>= k = TcS (\ebs -> unTcS m ebs >>= \r -> unTcS (k r) ebs)
instance MonadFail.MonadFail TcS where
diff --git a/compiler/types/Unify.hs b/compiler/types/Unify.hs
index 1e5406db2e..d13266660b 100644
--- a/compiler/types/Unify.hs
+++ b/compiler/types/Unify.hs
@@ -1215,7 +1215,9 @@ instance Applicative UM where
(<*>) = ap
instance Monad UM where
+#if !MIN_VERSION_base(4,13,0)
fail = MonadFail.fail
+#endif
m >>= k = UM (\state ->
do { (state', v) <- unUM m state
; unUM (k v) state' })
diff --git a/compiler/utils/IOEnv.hs b/compiler/utils/IOEnv.hs
index 4640b2b7c2..d6807da71a 100644
--- a/compiler/utils/IOEnv.hs
+++ b/compiler/utils/IOEnv.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
--
-- (c) The University of Glasgow 2002-2006
--
@@ -58,7 +59,9 @@ unIOEnv (IOEnv m) = m
instance Monad (IOEnv m) where
(>>=) = thenM
(>>) = (*>)
+#if !MIN_VERSION_base(4,13,0)
fail = MonadFail.fail
+#endif
instance MonadFail.MonadFail (IOEnv m) where
fail _ = failM -- Ignore the string
diff --git a/compiler/utils/ListT.hs b/compiler/utils/ListT.hs
index c16701419d..105e27b3d4 100644
--- a/compiler/utils/ListT.hs
+++ b/compiler/utils/ListT.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE FlexibleInstances #-}
@@ -67,9 +68,11 @@ instance Alternative (ListT f) where
instance Monad (ListT m) where
m >>= f = ListT $ \sk fk -> unListT m (\a fk' -> unListT (f a) sk fk') fk
+#if !MIN_VERSION_base(4,13,0)
fail = MonadFail.fail
+#endif
-instance MonadFail (ListT m) where
+instance MonadFail.MonadFail (ListT m) where
fail _ = ListT $ \_ fk -> fk
instance MonadPlus (ListT m) where