summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHerbert Valerio Riedel <hvr@gnu.org>2014-09-16 19:19:25 +0200
committerHerbert Valerio Riedel <hvr@gnu.org>2014-09-16 22:43:17 +0200
commitb47521991a7574f4f3554f7c5444a8c60cfe9efd (patch)
tree55bfb1876f31b841ae9d750aa87489ed6d2dc667
parente7a0f5b66ced8d56d770375e4d35d38c70067559 (diff)
downloadhaskell-b47521991a7574f4f3554f7c5444a8c60cfe9efd.tar.gz
Move `Maybe`-typedef into GHC.Base
This is preparatory work for reintroducing SPECIALISEs that were lost in d94de87252d0fe2ae97341d186b03a2fbe136b04 Differential Revision: https://phabricator.haskell.org/D214
-rw-r--r--libraries/base/Control/Exception.hs1
-rw-r--r--libraries/base/Control/Exception/Base.hs1
-rw-r--r--libraries/base/Data/Maybe.hs46
-rw-r--r--libraries/base/Data/Monoid.hs1
-rw-r--r--libraries/base/Data/OldTypeable/Internal.hs1
-rw-r--r--libraries/base/Data/Typeable/Internal.hs1
-rw-r--r--libraries/base/GHC/Base.lhs54
-rw-r--r--libraries/base/GHC/Conc/Signal.hs1
-rw-r--r--libraries/base/GHC/Event/EPoll.hsc1
-rw-r--r--libraries/base/GHC/Event/Internal.hs1
-rw-r--r--libraries/base/GHC/Event/Manager.hs2
-rw-r--r--libraries/base/GHC/Event/PSQ.hs1
-rw-r--r--libraries/base/GHC/Event/Poll.hsc1
-rw-r--r--libraries/base/GHC/Event/Thread.hs1
-rw-r--r--libraries/base/GHC/Event/TimerManager.hs1
-rw-r--r--libraries/base/GHC/IO.hs1
-rw-r--r--libraries/base/GHC/IO/BufferedIO.hs1
-rw-r--r--libraries/base/GHC/IO/Device.hs1
-rw-r--r--libraries/base/GHC/IO/Encoding.hs1
-rw-r--r--libraries/base/GHC/IO/Encoding/Failure.hs3
-rw-r--r--libraries/base/GHC/IO/Encoding/UTF16.hs1
-rw-r--r--libraries/base/GHC/IO/Encoding/UTF32.hs1
-rw-r--r--libraries/base/GHC/IO/Exception.hs1
-rw-r--r--libraries/base/GHC/IO/FD.hs1
-rw-r--r--libraries/base/GHC/IO/Handle/Types.hs1
-rw-r--r--libraries/base/GHC/MVar.hs1
-rw-r--r--libraries/base/GHC/Show.lhs1
-rw-r--r--libraries/base/GHC/Weak.lhs1
-rw-r--r--libraries/base/Numeric.hs1
-rw-r--r--libraries/base/Text/Read.hs1
-rw-r--r--libraries/template-haskell/Language/Haskell/TH/Syntax.hs4
-rw-r--r--testsuite/tests/ghci/scripts/T4175.stdout12
-rw-r--r--testsuite/tests/ghci/scripts/ghci023.stdout2
-rw-r--r--testsuite/tests/ghci/scripts/ghci026.stdout30
-rw-r--r--testsuite/tests/simplCore/should_compile/spec-inline.stderr38
-rw-r--r--testsuite/tests/th/ClosedFam1TH.stderr2
-rw-r--r--testsuite/tests/th/T4135.stderr4
-rw-r--r--testsuite/tests/th/T5037.stderr6
-rw-r--r--testsuite/tests/th/TH_RichKinds2.stderr6
-rw-r--r--testsuite/tests/th/TH_reifyDecl2.stderr3
-rw-r--r--testsuite/tests/th/TH_repGuard.stderr14
-rw-r--r--testsuite/tests/typecheck/should_fail/T5095.stderr1
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail072.stderr5
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail181.stderr3
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail182.stderr2
45 files changed, 121 insertions, 142 deletions
diff --git a/libraries/base/Control/Exception.hs b/libraries/base/Control/Exception.hs
index 7c019eb5ca..252597d70e 100644
--- a/libraries/base/Control/Exception.hs
+++ b/libraries/base/Control/Exception.hs
@@ -133,7 +133,6 @@ import Control.Exception.Base
import GHC.Base
import GHC.IO (unsafeUnmask)
-import Data.Maybe
-- | You need this when using 'catches'.
data Handler a = forall e . Exception e => Handler (e -> IO a)
diff --git a/libraries/base/Control/Exception/Base.hs b/libraries/base/Control/Exception/Base.hs
index 8df4958cbb..afb715193b 100644
--- a/libraries/base/Control/Exception/Base.hs
+++ b/libraries/base/Control/Exception/Base.hs
@@ -105,7 +105,6 @@ import GHC.Conc.Sync
import Data.Dynamic
import Data.Either
-import Data.Maybe
-----------------------------------------------------------------------------
-- Catching exceptions
diff --git a/libraries/base/Data/Maybe.hs b/libraries/base/Data/Maybe.hs
index de8eadcd6e..5923ae1061 100644
--- a/libraries/base/Data/Maybe.hs
+++ b/libraries/base/Data/Maybe.hs
@@ -34,52 +34,6 @@ module Data.Maybe
import GHC.Base
-- ---------------------------------------------------------------------------
--- The Maybe type, and instances
-
--- | The 'Maybe' type encapsulates an optional value. A value of type
--- @'Maybe' a@ either contains a value of type @a@ (represented as @'Just' a@),
--- or it is empty (represented as 'Nothing'). Using 'Maybe' is a good way to
--- deal with errors or exceptional cases without resorting to drastic
--- measures such as 'error'.
---
--- The 'Maybe' type is also a monad. It is a simple kind of error
--- monad, where all errors are represented by 'Nothing'. A richer
--- error monad can be built using the 'Data.Either.Either' type.
-
-data Maybe a = Nothing | Just a
- deriving (Eq, Ord)
-
--- | Lift a semigroup into 'Maybe' forming a 'Monoid' according to
--- <http://en.wikipedia.org/wiki/Monoid>: \"Any semigroup @S@ may be
--- turned into a monoid simply by adjoining an element @e@ not in @S@
--- and defining @e*e = e@ and @e*s = s = s*e@ for all @s ∈ S@.\" Since
--- there is no \"Semigroup\" typeclass providing just 'mappend', we
--- use 'Monoid' instead.
-instance Monoid a => Monoid (Maybe a) where
- mempty = Nothing
- Nothing `mappend` m = m
- m `mappend` Nothing = m
- Just m1 `mappend` Just m2 = Just (m1 `mappend` m2)
-
-instance Functor Maybe where
- fmap _ Nothing = Nothing
- fmap f (Just a) = Just (f a)
-
-instance Applicative Maybe where
- pure = return
- (<*>) = ap
-
-instance Monad Maybe where
- (Just x) >>= k = k x
- Nothing >>= _ = Nothing
-
- (Just _) >> k = k
- Nothing >> _ = Nothing
-
- return = Just
- fail _ = Nothing
-
--- ---------------------------------------------------------------------------
-- Functions over Maybe
-- | The 'maybe' function takes a default value, a function, and a 'Maybe'
diff --git a/libraries/base/Data/Monoid.hs b/libraries/base/Data/Monoid.hs
index 6b393b173e..8b8c8e80b7 100644
--- a/libraries/base/Data/Monoid.hs
+++ b/libraries/base/Data/Monoid.hs
@@ -46,7 +46,6 @@ import GHC.Num
import GHC.Read
import GHC.Show
import GHC.Generics
-import Data.Maybe
{-
-- just for testing
diff --git a/libraries/base/Data/OldTypeable/Internal.hs b/libraries/base/Data/OldTypeable/Internal.hs
index 2b02930466..d5e39c5688 100644
--- a/libraries/base/Data/OldTypeable/Internal.hs
+++ b/libraries/base/Data/OldTypeable/Internal.hs
@@ -57,7 +57,6 @@ module Data.OldTypeable.Internal {-# DEPRECATED "Use Data.Typeable.Internal inst
import GHC.Base
import GHC.Word
import GHC.Show
-import Data.Maybe
import Data.List
import GHC.Num
import GHC.Real
diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs
index b67f88c446..1a901792c1 100644
--- a/libraries/base/Data/Typeable/Internal.hs
+++ b/libraries/base/Data/Typeable/Internal.hs
@@ -54,7 +54,6 @@ import GHC.Base
import GHC.Word
import GHC.Show
import GHC.Read ( Read )
-import Data.Maybe
import Data.Proxy
import GHC.Num
import GHC.Real
diff --git a/libraries/base/GHC/Base.lhs b/libraries/base/GHC/Base.lhs
index 3267bbfa83..73bfb28d30 100644
--- a/libraries/base/GHC/Base.lhs
+++ b/libraries/base/GHC/Base.lhs
@@ -183,6 +183,29 @@ otherwise = True
build = error "urk"
foldr = error "urk"
-}
+
+\end{code}
+
+%*********************************************************
+%* *
+\subsection{The Maybe type}
+%* *
+%*********************************************************
+\begin{code}
+
+-- | The 'Maybe' type encapsulates an optional value. A value of type
+-- @'Maybe' a@ either contains a value of type @a@ (represented as @'Just' a@),
+-- or it is empty (represented as 'Nothing'). Using 'Maybe' is a good way to
+-- deal with errors or exceptional cases without resorting to drastic
+-- measures such as 'error'.
+--
+-- The 'Maybe' type is also a monad. It is a simple kind of error
+-- monad, where all errors are represented by 'Nothing'. A richer
+-- error monad can be built using the 'Data.Either.Either' type.
+--
+data Maybe a = Nothing | Just a
+ deriving (Eq, Ord)
+
\end{code}
%*********************************************************
@@ -272,6 +295,18 @@ instance Monoid Ordering where
EQ `mappend` y = y
GT `mappend` _ = GT
+-- | Lift a semigroup into 'Maybe' forming a 'Monoid' according to
+-- <http://en.wikipedia.org/wiki/Monoid>: \"Any semigroup @S@ may be
+-- turned into a monoid simply by adjoining an element @e@ not in @S@
+-- and defining @e*e = e@ and @e*s = s = s*e@ for all @s ∈ S@.\" Since
+-- there is no \"Semigroup\" typeclass providing just 'mappend', we
+-- use 'Monoid' instead.
+instance Monoid a => Monoid (Maybe a) where
+ mempty = Nothing
+ Nothing `mappend` m = m
+ m `mappend` Nothing = m
+ Just m1 `mappend` Just m2 = Just (m1 `mappend` m2)
+
instance Monoid a => Applicative ((,) a) where
pure x = (mempty, x)
(u, f) <*> (v, x) = (u `mappend` v, f x)
@@ -521,6 +556,25 @@ instance Monad ((->) r) where
instance Functor ((,) a) where
fmap f (x,y) = (x, f y)
+
+instance Functor Maybe where
+ fmap _ Nothing = Nothing
+ fmap f (Just a) = Just (f a)
+
+instance Applicative Maybe where
+ pure = return
+ (<*>) = ap
+
+instance Monad Maybe where
+ (Just x) >>= k = k x
+ Nothing >>= _ = Nothing
+
+ (Just _) >> k = k
+ Nothing >> _ = Nothing
+
+ return = Just
+ fail _ = Nothing
+
\end{code}
diff --git a/libraries/base/GHC/Conc/Signal.hs b/libraries/base/GHC/Conc/Signal.hs
index 2d70419145..3f5eacb572 100644
--- a/libraries/base/GHC/Conc/Signal.hs
+++ b/libraries/base/GHC/Conc/Signal.hs
@@ -10,7 +10,6 @@ module GHC.Conc.Signal
import Control.Concurrent.MVar (MVar, newMVar, withMVar)
import Data.Dynamic (Dynamic)
-import Data.Maybe (Maybe(..))
import Foreign.C.Types (CInt)
import Foreign.ForeignPtr (ForeignPtr)
import Foreign.StablePtr (castPtrToStablePtr, castStablePtrToPtr,
diff --git a/libraries/base/GHC/Event/EPoll.hsc b/libraries/base/GHC/Event/EPoll.hsc
index 298f450096..f3d635bb5f 100644
--- a/libraries/base/GHC/Event/EPoll.hsc
+++ b/libraries/base/GHC/Event/EPoll.hsc
@@ -40,7 +40,6 @@ available = False
import Control.Monad (when)
import Data.Bits (Bits, FiniteBits, (.|.), (.&.))
-import Data.Maybe (Maybe(..))
import Data.Word (Word32)
import Foreign.C.Error (eNOENT, getErrno, throwErrno,
throwErrnoIfMinus1, throwErrnoIfMinus1_)
diff --git a/libraries/base/GHC/Event/Internal.hs b/libraries/base/GHC/Event/Internal.hs
index fcd7886a20..f57cf9b88a 100644
--- a/libraries/base/GHC/Event/Internal.hs
+++ b/libraries/base/GHC/Event/Internal.hs
@@ -24,7 +24,6 @@ module GHC.Event.Internal
import Data.Bits ((.|.), (.&.))
import Data.List (foldl', intercalate)
-import Data.Maybe (Maybe(..))
import Foreign.C.Error (eINTR, getErrno, throwErrno)
import System.Posix.Types (Fd)
import GHC.Base
diff --git a/libraries/base/GHC/Event/Manager.hs b/libraries/base/GHC/Event/Manager.hs
index f07efba311..9f12ecd9dc 100644
--- a/libraries/base/GHC/Event/Manager.hs
+++ b/libraries/base/GHC/Event/Manager.hs
@@ -56,7 +56,7 @@ import Control.Monad ((=<<), forM_, when, replicateM, void)
import Data.Bits ((.&.))
import Data.IORef (IORef, atomicModifyIORef', mkWeakIORef, newIORef, readIORef,
writeIORef)
-import Data.Maybe (Maybe(..), maybe)
+import Data.Maybe (maybe)
import GHC.Arr (Array, (!), listArray)
import GHC.Base
import GHC.Conc.Signal (runHandlers)
diff --git a/libraries/base/GHC/Event/PSQ.hs b/libraries/base/GHC/Event/PSQ.hs
index 853958bc29..a623625761 100644
--- a/libraries/base/GHC/Event/PSQ.hs
+++ b/libraries/base/GHC/Event/PSQ.hs
@@ -88,7 +88,6 @@ module GHC.Event.PSQ
, atMost
) where
-import Data.Maybe (Maybe(..))
import GHC.Base
import GHC.Num (Num(..))
import GHC.Show (Show(showsPrec))
diff --git a/libraries/base/GHC/Event/Poll.hsc b/libraries/base/GHC/Event/Poll.hsc
index ad2a96f56f..fd05a13799 100644
--- a/libraries/base/GHC/Event/Poll.hsc
+++ b/libraries/base/GHC/Event/Poll.hsc
@@ -28,7 +28,6 @@ available = False
import Control.Concurrent.MVar (MVar, newMVar, swapMVar)
import Control.Monad ((=<<), unless)
import Data.Bits (Bits, FiniteBits, (.|.), (.&.))
-import Data.Maybe (Maybe(..))
import Data.Word
import Foreign.C.Types (CInt(..), CShort(..))
import Foreign.Ptr (Ptr)
diff --git a/libraries/base/GHC/Event/Thread.hs b/libraries/base/GHC/Event/Thread.hs
index 0a82a548da..3d4dc7d405 100644
--- a/libraries/base/GHC/Event/Thread.hs
+++ b/libraries/base/GHC/Event/Thread.hs
@@ -19,7 +19,6 @@ import Control.Exception (finally, SomeException, toException)
import Control.Monad (forM, forM_, sequence_, zipWithM, when)
import Data.IORef (IORef, newIORef, readIORef, writeIORef)
import Data.List (zipWith3)
-import Data.Maybe (Maybe(..))
import Data.Tuple (snd)
import Foreign.C.Error (eBADF, errnoToIOError)
import Foreign.C.Types (CInt(..), CUInt(..))
diff --git a/libraries/base/GHC/Event/TimerManager.hs b/libraries/base/GHC/Event/TimerManager.hs
index cbfce59434..435693a927 100644
--- a/libraries/base/GHC/Event/TimerManager.hs
+++ b/libraries/base/GHC/Event/TimerManager.hs
@@ -42,7 +42,6 @@ import Control.Exception (finally)
import Control.Monad ((=<<), sequence_, when)
import Data.IORef (IORef, atomicModifyIORef', mkWeakIORef, newIORef, readIORef,
writeIORef)
-import Data.Maybe (Maybe(..))
import GHC.Base
import GHC.Conc.Signal (runHandlers)
import GHC.Num (Num(..))
diff --git a/libraries/base/GHC/IO.hs b/libraries/base/GHC/IO.hs
index 388c81f138..1d86b8d12a 100644
--- a/libraries/base/GHC/IO.hs
+++ b/libraries/base/GHC/IO.hs
@@ -44,7 +44,6 @@ import GHC.Base
import GHC.ST
import GHC.Exception
import GHC.Show
-import Data.Maybe
import {-# SOURCE #-} GHC.IO.Exception ( userError )
diff --git a/libraries/base/GHC/IO/BufferedIO.hs b/libraries/base/GHC/IO/BufferedIO.hs
index b715c61380..cc98be76d1 100644
--- a/libraries/base/GHC/IO/BufferedIO.hs
+++ b/libraries/base/GHC/IO/BufferedIO.hs
@@ -25,7 +25,6 @@ import GHC.Base
import GHC.Ptr
import Data.Word
import GHC.Num
-import Data.Maybe
import GHC.IO.Device as IODevice
import GHC.IO.Device as RawIO
import GHC.IO.Buffer
diff --git a/libraries/base/GHC/IO/Device.hs b/libraries/base/GHC/IO/Device.hs
index e20cdf0770..b6c973b7e0 100644
--- a/libraries/base/GHC/IO/Device.hs
+++ b/libraries/base/GHC/IO/Device.hs
@@ -29,7 +29,6 @@ import GHC.Enum
import GHC.Read
import GHC.Show
import GHC.Ptr
-import Data.Maybe
import GHC.Num
import GHC.IO
import {-# SOURCE #-} GHC.IO.Exception ( unsupportedOperation )
diff --git a/libraries/base/GHC/IO/Encoding.hs b/libraries/base/GHC/IO/Encoding.hs
index eb4d74ccfc..9d03276c98 100644
--- a/libraries/base/GHC/IO/Encoding.hs
+++ b/libraries/base/GHC/IO/Encoding.hs
@@ -49,7 +49,6 @@ import GHC.Word
import Data.IORef
import Data.Char (toUpper)
import Data.List
-import Data.Maybe
import System.IO.Unsafe (unsafePerformIO)
-- -----------------------------------------------------------------------------
diff --git a/libraries/base/GHC/IO/Encoding/Failure.hs b/libraries/base/GHC/IO/Encoding/Failure.hs
index 4b24d06012..6e06213ae2 100644
--- a/libraries/base/GHC/IO/Encoding/Failure.hs
+++ b/libraries/base/GHC/IO/Encoding/Failure.hs
@@ -34,9 +34,6 @@ import GHC.Real ( fromIntegral )
--import System.Posix.Internals
-import Data.Maybe
-
-
-- | The 'CodingFailureMode' is used to construct 'TextEncoding's, and
-- specifies how they handle illegal sequences.
data CodingFailureMode
diff --git a/libraries/base/GHC/IO/Encoding/UTF16.hs b/libraries/base/GHC/IO/Encoding/UTF16.hs
index b0ff992a0d..c6dc7c0a76 100644
--- a/libraries/base/GHC/IO/Encoding/UTF16.hs
+++ b/libraries/base/GHC/IO/Encoding/UTF16.hs
@@ -47,7 +47,6 @@ import GHC.IO.Encoding.Failure
import GHC.IO.Encoding.Types
import GHC.Word
import Data.Bits
-import Data.Maybe
import GHC.IORef
-- -----------------------------------------------------------------------------
diff --git a/libraries/base/GHC/IO/Encoding/UTF32.hs b/libraries/base/GHC/IO/Encoding/UTF32.hs
index eddc4f8693..8d996b14b9 100644
--- a/libraries/base/GHC/IO/Encoding/UTF32.hs
+++ b/libraries/base/GHC/IO/Encoding/UTF32.hs
@@ -47,7 +47,6 @@ import GHC.IO.Encoding.Failure
import GHC.IO.Encoding.Types
import GHC.Word
import Data.Bits
-import Data.Maybe
import GHC.IORef
-- -----------------------------------------------------------------------------
diff --git a/libraries/base/GHC/IO/Exception.hs b/libraries/base/GHC/IO/Exception.hs
index e7e3316ca9..0f351f0382 100644
--- a/libraries/base/GHC/IO/Exception.hs
+++ b/libraries/base/GHC/IO/Exception.hs
@@ -48,7 +48,6 @@ import GHC.IO
import GHC.Show
import GHC.Read
import GHC.Exception
-import Data.Maybe
import GHC.IO.Handle.Types
import Foreign.C.Types
diff --git a/libraries/base/GHC/IO/FD.hs b/libraries/base/GHC/IO/FD.hs
index 1134e95f8d..1783125a90 100644
--- a/libraries/base/GHC/IO/FD.hs
+++ b/libraries/base/GHC/IO/FD.hs
@@ -35,7 +35,6 @@ import GHC.Num
import GHC.Real
import GHC.Show
import GHC.Enum
-import Data.Maybe
import Control.Monad
import Data.Typeable
diff --git a/libraries/base/GHC/IO/Handle/Types.hs b/libraries/base/GHC/IO/Handle/Types.hs
index defa33bbca..fbedeecdbd 100644
--- a/libraries/base/GHC/IO/Handle/Types.hs
+++ b/libraries/base/GHC/IO/Handle/Types.hs
@@ -42,7 +42,6 @@ import GHC.IO.Buffer
import GHC.IO.BufferedIO
import GHC.IO.Encoding.Types
import GHC.IORef
-import Data.Maybe
import GHC.Show
import GHC.Read
import GHC.Word
diff --git a/libraries/base/GHC/MVar.hs b/libraries/base/GHC/MVar.hs
index ff138a5ef2..5bdb6ff82a 100644
--- a/libraries/base/GHC/MVar.hs
+++ b/libraries/base/GHC/MVar.hs
@@ -33,7 +33,6 @@ module GHC.MVar (
) where
import GHC.Base
-import Data.Maybe
import Data.Typeable
data MVar a = MVar (MVar# RealWorld a) deriving( Typeable )
diff --git a/libraries/base/GHC/Show.lhs b/libraries/base/GHC/Show.lhs
index 09c3c56cd9..93320eea1b 100644
--- a/libraries/base/GHC/Show.lhs
+++ b/libraries/base/GHC/Show.lhs
@@ -52,7 +52,6 @@ module GHC.Show
import GHC.Base
import GHC.Num
-import Data.Maybe
import GHC.List ((!!), foldr1, break)
\end{code}
diff --git a/libraries/base/GHC/Weak.lhs b/libraries/base/GHC/Weak.lhs
index bffd9f8236..5405a302ed 100644
--- a/libraries/base/GHC/Weak.lhs
+++ b/libraries/base/GHC/Weak.lhs
@@ -32,7 +32,6 @@ module GHC.Weak (
) where
import GHC.Base
-import Data.Maybe
import Data.Typeable
{-|
diff --git a/libraries/base/Numeric.hs b/libraries/base/Numeric.hs
index 4a1a5b121a..7cba671309 100644
--- a/libraries/base/Numeric.hs
+++ b/libraries/base/Numeric.hs
@@ -65,7 +65,6 @@ import GHC.Real
import GHC.Float
import GHC.Num
import GHC.Show
-import Data.Maybe
import Text.ParserCombinators.ReadP( ReadP, readP_to_S, pfail )
import qualified Text.Read.Lex as L
diff --git a/libraries/base/Text/Read.hs b/libraries/base/Text/Read.hs
index 6c9d89db76..18c485fea1 100644
--- a/libraries/base/Text/Read.hs
+++ b/libraries/base/Text/Read.hs
@@ -47,7 +47,6 @@ module Text.Read (
import GHC.Base
import GHC.Read
import Data.Either
-import Data.Maybe
import Text.ParserCombinators.ReadP as P
import Text.ParserCombinators.ReadPrec
import qualified Text.Read.Lex as L
diff --git a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
index 650410841e..268838e195 100644
--- a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
+++ b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
@@ -512,8 +512,8 @@ trueName = mkNameG DataName "ghc-prim" "GHC.Types" "True"
falseName = mkNameG DataName "ghc-prim" "GHC.Types" "False"
nothingName, justName :: Name
-nothingName = mkNameG DataName "base" "Data.Maybe" "Nothing"
-justName = mkNameG DataName "base" "Data.Maybe" "Just"
+nothingName = mkNameG DataName "base" "GHC.Base" "Nothing"
+justName = mkNameG DataName "base" "GHC.Base" "Just"
leftName, rightName :: Name
leftName = mkNameG DataName "base" "Data.Either" "Left"
diff --git a/testsuite/tests/ghci/scripts/T4175.stdout b/testsuite/tests/ghci/scripts/T4175.stdout
index 2a75b0da6a..e439528965 100644
--- a/testsuite/tests/ghci/scripts/T4175.stdout
+++ b/testsuite/tests/ghci/scripts/T4175.stdout
@@ -28,14 +28,14 @@ instance Show () -- Defined in ‘GHC.Show’
type instance D () () = Bool -- Defined at T4175.hs:22:5
type instance D Int () = String -- Defined at T4175.hs:19:5
data instance B () = MkB -- Defined at T4175.hs:13:15
-data Maybe a = Nothing | Just a -- Defined in ‘Data.Maybe’
-instance Eq a => Eq (Maybe a) -- Defined in ‘Data.Maybe’
-instance Monad Maybe -- Defined in ‘Data.Maybe’
-instance Functor Maybe -- Defined in ‘Data.Maybe’
-instance Ord a => Ord (Maybe a) -- Defined in ‘Data.Maybe’
+data Maybe a = Nothing | Just a -- Defined in ‘GHC.Base’
+instance Eq a => Eq (Maybe a) -- Defined in ‘GHC.Base’
+instance Monad Maybe -- Defined in ‘GHC.Base’
+instance Functor Maybe -- Defined in ‘GHC.Base’
+instance Ord a => Ord (Maybe a) -- Defined in ‘GHC.Base’
instance Read a => Read (Maybe a) -- Defined in ‘GHC.Read’
instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’
-instance Applicative Maybe -- Defined in ‘Data.Maybe’
+instance Applicative Maybe -- Defined in ‘GHC.Base’
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:1
diff --git a/testsuite/tests/ghci/scripts/ghci023.stdout b/testsuite/tests/ghci/scripts/ghci023.stdout
index 5f19876614..51c1b9196a 100644
--- a/testsuite/tests/ghci/scripts/ghci023.stdout
+++ b/testsuite/tests/ghci/scripts/ghci023.stdout
@@ -1,7 +1,6 @@
-- testing ghci multiline commands :{ .. :}
-- via stdin
(1,2,3)
-data Maybe a = Nothing | Just a
Data.Maybe.catMaybes :: [Maybe a] -> [a]
Data.Maybe.fromJust :: Maybe a -> a
Data.Maybe.fromMaybe :: a -> Maybe a -> a
@@ -11,6 +10,7 @@ Data.Maybe.listToMaybe :: [a] -> Maybe a
Data.Maybe.mapMaybe :: (a -> Maybe b) -> [a] -> [b]
maybe :: b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybeToList :: Maybe a -> [a]
+data Maybe a = Nothing | Just a
-- via readFile
(True,False)
id :: a -> a
diff --git a/testsuite/tests/ghci/scripts/ghci026.stdout b/testsuite/tests/ghci/scripts/ghci026.stdout
index 163cca29b6..9fb27908e6 100644
--- a/testsuite/tests/ghci/scripts/ghci026.stdout
+++ b/testsuite/tests/ghci/scripts/ghci026.stdout
@@ -1,15 +1,15 @@
-data Maybe a = Nothing | Just a
-catMaybes :: [Maybe a] -> [a]
-fromJust :: Maybe a -> a
-fromMaybe :: a -> Maybe a -> a
-isJust :: Maybe a -> Bool
-isNothing :: Maybe a -> Bool
-listToMaybe :: [a] -> Maybe a
-mapMaybe :: (a -> Maybe b) -> [a] -> [b]
-maybe :: b -> (a -> b) -> Maybe a -> b
-maybeToList :: Maybe a -> [a]
-data T = A Int | B Float
-f :: Double -> Double
-g :: Double -> Double
-h :: Integral a => a -> a
-f :: Double -> Double
+catMaybes :: [Maybe a] -> [a]
+fromJust :: Maybe a -> a
+fromMaybe :: a -> Maybe a -> a
+isJust :: Maybe a -> Bool
+isNothing :: Maybe a -> Bool
+listToMaybe :: [a] -> Maybe a
+mapMaybe :: (a -> Maybe b) -> [a] -> [b]
+maybe :: b -> (a -> b) -> Maybe a -> b
+maybeToList :: Maybe a -> [a]
+data Maybe a = Nothing | Just a
+data T = A Int | B Float
+f :: Double -> Double
+g :: Double -> Double
+h :: Integral a => a -> a
+f :: Double -> Double
diff --git a/testsuite/tests/simplCore/should_compile/spec-inline.stderr b/testsuite/tests/simplCore/should_compile/spec-inline.stderr
index 1e11fd618b..aee86c36fa 100644
--- a/testsuite/tests/simplCore/should_compile/spec-inline.stderr
+++ b/testsuite/tests/simplCore/should_compile/spec-inline.stderr
@@ -43,19 +43,19 @@ Roman.foo_$s$wgo =
end Rec }
Roman.$wgo [InlPrag=[0]]
- :: Data.Maybe.Maybe GHC.Types.Int
- -> Data.Maybe.Maybe GHC.Types.Int -> GHC.Prim.Int#
+ :: GHC.Base.Maybe GHC.Types.Int
+ -> GHC.Base.Maybe GHC.Types.Int -> GHC.Prim.Int#
[GblId,
Arity=2,
Str=DmdType <S,1*U><S,1*U>,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True, Guidance=IF_ARGS [60 30] 256 0}]
Roman.$wgo =
- \ (w :: Data.Maybe.Maybe GHC.Types.Int)
- (w1 :: Data.Maybe.Maybe GHC.Types.Int) ->
+ \ (w :: GHC.Base.Maybe GHC.Types.Int)
+ (w1 :: GHC.Base.Maybe GHC.Types.Int) ->
case w1 of _ [Occ=Dead] {
- Data.Maybe.Nothing -> case Roman.foo3 of wild1 { };
- Data.Maybe.Just x ->
+ GHC.Base.Nothing -> case Roman.foo3 of wild1 { };
+ GHC.Base.Just x ->
case x of _ [Occ=Dead] { GHC.Types.I# ipv ->
let {
a :: GHC.Prim.Int#
@@ -68,8 +68,8 @@ Roman.$wgo =
ipv)
ipv } in
case w of _ [Occ=Dead] {
- Data.Maybe.Nothing -> Roman.foo_$s$wgo 10 a;
- Data.Maybe.Just n ->
+ GHC.Base.Nothing -> Roman.foo_$s$wgo 10 a;
+ GHC.Base.Just n ->
case n of _ [Occ=Dead] { GHC.Types.I# x2 ->
case GHC.Prim.tagToEnum# @ GHC.Types.Bool (GHC.Prim.<=# x2 0)
of _ [Occ=Dead] {
@@ -93,20 +93,20 @@ Roman.$wgo =
}
Roman.foo_go [InlPrag=INLINE[0]]
- :: Data.Maybe.Maybe GHC.Types.Int
- -> Data.Maybe.Maybe GHC.Types.Int -> GHC.Types.Int
+ :: GHC.Base.Maybe GHC.Types.Int
+ -> GHC.Base.Maybe GHC.Types.Int -> GHC.Types.Int
[GblId,
Arity=2,
Str=DmdType <S,1*U><S,1*U>m,
Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True,
Guidance=ALWAYS_IF(arity=2,unsat_ok=True,boring_ok=False)
- Tmpl= \ (w [Occ=Once] :: Data.Maybe.Maybe GHC.Types.Int)
- (w1 [Occ=Once] :: Data.Maybe.Maybe GHC.Types.Int) ->
+ Tmpl= \ (w [Occ=Once] :: GHC.Base.Maybe GHC.Types.Int)
+ (w1 [Occ=Once] :: GHC.Base.Maybe GHC.Types.Int) ->
case Roman.$wgo w w1 of ww { __DEFAULT -> GHC.Types.I# ww }}]
Roman.foo_go =
- \ (w :: Data.Maybe.Maybe GHC.Types.Int)
- (w1 :: Data.Maybe.Maybe GHC.Types.Int) ->
+ \ (w :: GHC.Base.Maybe GHC.Types.Int)
+ (w1 :: GHC.Base.Maybe GHC.Types.Int) ->
case Roman.$wgo w w1 of ww { __DEFAULT -> GHC.Types.I# ww }
Roman.foo2 :: GHC.Types.Int
@@ -117,13 +117,13 @@ Roman.foo2 :: GHC.Types.Int
WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 20}]
Roman.foo2 = GHC.Types.I# 6
-Roman.foo1 :: Data.Maybe.Maybe GHC.Types.Int
+Roman.foo1 :: GHC.Base.Maybe GHC.Types.Int
[GblId,
Caf=NoCafRefs,
Str=DmdType m2,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 20}]
-Roman.foo1 = Data.Maybe.Just @ GHC.Types.Int Roman.foo2
+Roman.foo1 = GHC.Base.Just @ GHC.Types.Int Roman.foo2
Roman.foo :: GHC.Types.Int -> GHC.Types.Int
[GblId,
@@ -135,7 +135,7 @@ Roman.foo :: GHC.Types.Int -> GHC.Types.Int
Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=False)
Tmpl= \ (n [Occ=Once!] :: GHC.Types.Int) ->
case n of n1 { GHC.Types.I# _ [Occ=Dead] ->
- Roman.foo_go (Data.Maybe.Just @ GHC.Types.Int n1) Roman.foo1
+ Roman.foo_go (GHC.Base.Just @ GHC.Types.Int n1) Roman.foo1
}}]
Roman.foo =
\ (n :: GHC.Types.Int) ->
@@ -147,8 +147,8 @@ Roman.foo =
------ Local rules for imported ids --------
"SC:$wgo0" [0]
forall (sc :: GHC.Prim.Int#) (sc1 :: GHC.Prim.Int#).
- Roman.$wgo (Data.Maybe.Just @ GHC.Types.Int (GHC.Types.I# sc))
- (Data.Maybe.Just @ GHC.Types.Int (GHC.Types.I# sc1))
+ Roman.$wgo (GHC.Base.Just @ GHC.Types.Int (GHC.Types.I# sc))
+ (GHC.Base.Just @ GHC.Types.Int (GHC.Types.I# sc1))
= Roman.foo_$s$wgo sc sc1
diff --git a/testsuite/tests/th/ClosedFam1TH.stderr b/testsuite/tests/th/ClosedFam1TH.stderr
index b2d0a9bac4..8855da204f 100644
--- a/testsuite/tests/th/ClosedFam1TH.stderr
+++ b/testsuite/tests/th/ClosedFam1TH.stderr
@@ -2,5 +2,5 @@
ClosedFam1TH.hs:7:3: Warning:
type family Foo_0 a_1 (b_2 :: k_3) where
Foo_0 GHC.Types.Int GHC.Types.Bool = GHC.Types.Int
- Foo_0 a_4 Data.Maybe.Maybe = GHC.Types.Bool
+ Foo_0 a_4 GHC.Base.Maybe = GHC.Types.Bool
Foo_0 b_5 (x_6 :: GHC.Types.Bool) = GHC.Types.Char
diff --git a/testsuite/tests/th/T4135.stderr b/testsuite/tests/th/T4135.stderr
index 30df0def66..c666082754 100644
--- a/testsuite/tests/th/T4135.stderr
+++ b/testsuite/tests/th/T4135.stderr
@@ -1,2 +1,2 @@
-instance Bug.C (Data.Maybe.Maybe a_0)
- where type Bug.T (Data.Maybe.Maybe a_0) = GHC.Types.Char
+instance Bug.C (GHC.Base.Maybe a_0)
+ where type Bug.T (GHC.Base.Maybe a_0) = GHC.Types.Char
diff --git a/testsuite/tests/th/T5037.stderr b/testsuite/tests/th/T5037.stderr
index 391368c93b..944cfa5c8c 100644
--- a/testsuite/tests/th/T5037.stderr
+++ b/testsuite/tests/th/T5037.stderr
@@ -1,3 +1,3 @@
-f_0 :: Data.Maybe.Maybe GHC.Types.Int -> GHC.Types.Int
-f_0 (Data.Maybe.Nothing) = 3
-f_0 (Data.Maybe.Just x_1) = x
+f_0 :: GHC.Base.Maybe GHC.Types.Int -> GHC.Types.Int
+f_0 (GHC.Base.Nothing) = 3
+f_0 (GHC.Base.Just x_1) = x
diff --git a/testsuite/tests/th/TH_RichKinds2.stderr b/testsuite/tests/th/TH_RichKinds2.stderr
index 8370df332d..45027d5c1c 100644
--- a/testsuite/tests/th/TH_RichKinds2.stderr
+++ b/testsuite/tests/th/TH_RichKinds2.stderr
@@ -1,8 +1,8 @@
TH_RichKinds2.hs:23:4: Warning:
- data SMaybe_0 (t_1 :: k_0 -> *) (t_3 :: Data.Maybe.Maybe k_0)
- = forall . t_3 ~ 'Data.Maybe.Nothing => SNothing_4
- | forall a_5 . t_3 ~ 'Data.Maybe.Just a_5 => SJust_6 (t_1 a_5)
+ data SMaybe_0 (t_1 :: k_0 -> *) (t_3 :: GHC.Base.Maybe k_0)
+ = forall . t_3 ~ 'GHC.Base.Nothing => SNothing_4
+ | forall a_5 . t_3 ~ 'GHC.Base.Just a_5 => SJust_6 (t_1 a_5)
type instance TH_RichKinds2.Map f_7 'GHC.Types.[] = 'GHC.Types.[]
type instance TH_RichKinds2.Map f_8
('GHC.Types.: h_9 t_10) = 'GHC.Types.: (f_8 h_9)
diff --git a/testsuite/tests/th/TH_reifyDecl2.stderr b/testsuite/tests/th/TH_reifyDecl2.stderr
index 802cf293c6..3711f8e224 100644
--- a/testsuite/tests/th/TH_reifyDecl2.stderr
+++ b/testsuite/tests/th/TH_reifyDecl2.stderr
@@ -1,2 +1 @@
-data Data.Maybe.Maybe a_0
- = Data.Maybe.Nothing | Data.Maybe.Just a_0
+data GHC.Base.Maybe a_0 = GHC.Base.Nothing | GHC.Base.Just a_0
diff --git a/testsuite/tests/th/TH_repGuard.stderr b/testsuite/tests/th/TH_repGuard.stderr
index c0a4dd7cba..bbef7eed59 100644
--- a/testsuite/tests/th/TH_repGuard.stderr
+++ b/testsuite/tests/th/TH_repGuard.stderr
@@ -1,7 +1,7 @@
-foo_0 :: GHC.Types.Int -> GHC.Types.Int
-foo_0 x_1 | x_1 GHC.Classes.== 5 = 6
-foo_0 x_2 = 7
-bar_0 :: Data.Maybe.Maybe GHC.Types.Int -> GHC.Types.Int
-bar_0 x_1 | Data.Maybe.Just y_2 <- x_1
- = y_2
-bar_0 _ = 9
+foo_0 :: GHC.Types.Int -> GHC.Types.Int
+foo_0 x_1 | x_1 GHC.Classes.== 5 = 6
+foo_0 x_2 = 7
+bar_0 :: GHC.Base.Maybe GHC.Types.Int -> GHC.Types.Int
+bar_0 x_1 | GHC.Base.Just y_2 <- x_1
+ = y_2
+bar_0 _ = 9
diff --git a/testsuite/tests/typecheck/should_fail/T5095.stderr b/testsuite/tests/typecheck/should_fail/T5095.stderr
index 55342cdf33..82613e64d9 100644
--- a/testsuite/tests/typecheck/should_fail/T5095.stderr
+++ b/testsuite/tests/typecheck/should_fail/T5095.stderr
@@ -3,6 +3,7 @@ T5095.hs:9:11:
Overlapping instances for Eq a arising from a use of ‘==’
Matching instances:
instance [overlappable] Show a => Eq a -- Defined at T5095.hs:5:31
+ instance Eq a => Eq (Maybe a) -- Defined in ‘GHC.Base’
instance Eq () -- Defined in ‘GHC.Classes’
instance (Eq a, Eq b) => Eq (a, b) -- Defined in ‘GHC.Classes’
instance (Eq a, Eq b, Eq c) => Eq (a, b, c)
diff --git a/testsuite/tests/typecheck/should_fail/tcfail072.stderr b/testsuite/tests/typecheck/should_fail/tcfail072.stderr
index 37bb8b3ad3..64486c1cb0 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail072.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail072.stderr
@@ -7,10 +7,9 @@ tcfail072.hs:23:13:
at tcfail072.hs:22:6-38
The type variable ‘q0’ is ambiguous
Note: there are several potential instances:
+ instance Ord a => Ord (Maybe a) -- Defined in ‘GHC.Base’
instance Ord () -- Defined in ‘GHC.Classes’
instance (Ord a, Ord b) => Ord (a, b) -- Defined in ‘GHC.Classes’
- instance (Ord a, Ord b, Ord c) => Ord (a, b, c)
- -- Defined in ‘GHC.Classes’
- ...plus 21 others
+ ...plus 22 others
In the expression: g A
In an equation for ‘g’: g (B _ _) = g A
diff --git a/testsuite/tests/typecheck/should_fail/tcfail181.stderr b/testsuite/tests/typecheck/should_fail/tcfail181.stderr
index 3502f2bbea..7ec625bac1 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail181.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail181.stderr
@@ -9,7 +9,8 @@ tcfail181.hs:17:9:
Note: there are several potential instances:
instance Monad ((->) r) -- Defined in ‘GHC.Base’
instance Monad IO -- Defined in ‘GHC.Base’
- instance Monad [] -- Defined in ‘GHC.Base’
+ instance Monad Maybe -- Defined in ‘GHC.Base’
+ ...plus one other
In the expression: foo
In the expression: foo {bar = return True}
In an equation for ‘wog’: wog x = foo {bar = return True}
diff --git a/testsuite/tests/typecheck/should_fail/tcfail182.stderr b/testsuite/tests/typecheck/should_fail/tcfail182.stderr
index 373e6dcad5..dfc57e2a03 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail182.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail182.stderr
@@ -3,7 +3,7 @@ tcfail182.hs:9:3:
Couldn't match expected type ‘Prelude.Maybe a’
with actual type ‘Maybe t0’
NB: ‘Prelude.Maybe’
- is defined in ‘Data.Maybe’ in package ‘base-4.8.0.0’
+ is defined in ‘GHC.Base’ in package ‘base-4.8.0.0’
‘Maybe’ is defined at tcfail182.hs:6:1-18
Relevant bindings include
f :: Prelude.Maybe a -> Int (bound at tcfail182.hs:9:1)