summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShayne Fletcher <shayne.fletcher@digitalasset.com>2018-08-21 07:58:16 -0400
committerKrzysztof Gogolewski <krz.gogolewski@gmail.com>2018-09-18 19:05:25 +0200
commit01f7cd799c1c0eb3fa91e5e0c3ca1d08594121bd (patch)
tree947e43f172dfac3f7d28fca223642b1aca7d4332
parent4edc6d64d1bc1898c0974cf26c5713a3b2724a0b (diff)
downloadhaskell-01f7cd799c1c0eb3fa91e5e0c3ca1d08594121bd.tar.gz
NoImplicitPrelude in ghc-boot-th, ghc-boot, ghc-heap, ghci
PR: https://github.com/ghc/ghc/pull/184
-rw-r--r--compiler/utils/GhcPrelude.hs13
-rw-r--r--libraries/ghc-boot-th/GHC/ForeignSrcLang/Type.hs1
-rw-r--r--libraries/ghc-boot-th/GHC/LanguageExtensions/Type.hs1
-rw-r--r--libraries/ghc-boot-th/GHC/Lexeme.hs1
-rw-r--r--libraries/ghc-boot-th/ghc-boot-th.cabal.in1
-rw-r--r--libraries/ghc-boot/GHC/HandleEncoding.hs1
-rw-r--r--libraries/ghc-boot/GHC/PackageDb.hs1
-rw-r--r--libraries/ghc-boot/GHC/Serialized.hs1
-rw-r--r--libraries/ghc-boot/ghc-boot.cabal.in1
-rw-r--r--libraries/ghc-heap/GHC/Exts/Heap.hs1
-rw-r--r--libraries/ghc-heap/GHC/Exts/Heap/ClosureTypes.hs1
-rw-r--r--libraries/ghc-heap/GHC/Exts/Heap/Closures.hs1
-rw-r--r--libraries/ghc-heap/GHC/Exts/Heap/Constants.hsc1
-rw-r--r--libraries/ghc-heap/GHC/Exts/Heap/InfoTable.hsc1
-rw-r--r--libraries/ghc-heap/GHC/Exts/Heap/InfoTable/Types.hsc1
-rw-r--r--libraries/ghc-heap/GHC/Exts/Heap/InfoTableProf.hsc1
-rw-r--r--libraries/ghc-heap/GHC/Exts/Heap/Utils.hsc1
-rw-r--r--libraries/ghc-heap/ghc-heap.cabal.in3
-rw-r--r--libraries/ghci/GHCi/BinaryArray.hs1
-rw-r--r--libraries/ghci/GHCi/BreakArray.hs1
-rw-r--r--libraries/ghci/GHCi/CreateBCO.hs1
-rw-r--r--libraries/ghci/GHCi/FFI.hsc1
-rw-r--r--libraries/ghci/GHCi/InfoTable.hsc1
-rw-r--r--libraries/ghci/GHCi/Message.hs1
-rw-r--r--libraries/ghci/GHCi/ObjLink.hs1
-rw-r--r--libraries/ghci/GHCi/RemoteTypes.hs1
-rw-r--r--libraries/ghci/GHCi/ResolvedBCO.hs1
-rw-r--r--libraries/ghci/GHCi/Run.hs1
-rw-r--r--libraries/ghci/GHCi/Signals.hs1
-rw-r--r--libraries/ghci/GHCi/StaticPtrTable.hs1
-rw-r--r--libraries/ghci/GHCi/TH.hs1
-rw-r--r--libraries/ghci/GHCi/TH/Binary.hs1
-rw-r--r--libraries/ghci/SizedSeq.hs1
-rw-r--r--libraries/ghci/ghci.cabal.in1
34 files changed, 48 insertions, 0 deletions
diff --git a/compiler/utils/GhcPrelude.hs b/compiler/utils/GhcPrelude.hs
index 574c29d188..66d01be5f8 100644
--- a/compiler/utils/GhcPrelude.hs
+++ b/compiler/utils/GhcPrelude.hs
@@ -20,3 +20,16 @@ import Data.Semigroup as X (Semigroup)
#endif
import Data.Foldable as X (foldl')
+
+{-
+Note [Why do we import Prelude here?]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+The files ghc-boot-th.cabal, ghc-boot.cabal, ghci.cabal and
+ghc-heap.cabal contain the directive default-extensions:
+NoImplicitPrelude. There are two motivations for this:
+ - Consistency with the compiler directory, which enables
+ NoImplicitPrelude;
+ - Allows loading the above dependent packages with ghc-in-ghci,
+ giving a smoother development experience when adding new
+ extensions.
+-}
diff --git a/libraries/ghc-boot-th/GHC/ForeignSrcLang/Type.hs b/libraries/ghc-boot-th/GHC/ForeignSrcLang/Type.hs
index 4841de89c7..3106141de7 100644
--- a/libraries/ghc-boot-th/GHC/ForeignSrcLang/Type.hs
+++ b/libraries/ghc-boot-th/GHC/ForeignSrcLang/Type.hs
@@ -3,6 +3,7 @@ module GHC.ForeignSrcLang.Type
( ForeignSrcLang(..)
) where
+import Prelude -- See note [Why do we import Prelude here?]
import GHC.Generics (Generic)
data ForeignSrcLang
diff --git a/libraries/ghc-boot-th/GHC/LanguageExtensions/Type.hs b/libraries/ghc-boot-th/GHC/LanguageExtensions/Type.hs
index c01ea32fa8..2c06a74df9 100644
--- a/libraries/ghc-boot-th/GHC/LanguageExtensions/Type.hs
+++ b/libraries/ghc-boot-th/GHC/LanguageExtensions/Type.hs
@@ -11,6 +11,7 @@
{-# LANGUAGE DeriveGeneric #-}
module GHC.LanguageExtensions.Type ( Extension(..) ) where
+import Prelude -- See note [Why do we import Prelude here?]
import GHC.Generics
-- | The language extensions known to GHC.
diff --git a/libraries/ghc-boot-th/GHC/Lexeme.hs b/libraries/ghc-boot-th/GHC/Lexeme.hs
index 2ecee61ea6..5093c98f1e 100644
--- a/libraries/ghc-boot-th/GHC/Lexeme.hs
+++ b/libraries/ghc-boot-th/GHC/Lexeme.hs
@@ -14,6 +14,7 @@ module GHC.Lexeme (
startsVarSymASCII, isVarSymChar, okSymChar
) where
+import Prelude -- See note [Why do we import Prelude here?]
import Data.Char
-- | Is this character acceptable in a symbol (after the first char)?
diff --git a/libraries/ghc-boot-th/ghc-boot-th.cabal.in b/libraries/ghc-boot-th/ghc-boot-th.cabal.in
index 2e45e8e25c..b52c8ab570 100644
--- a/libraries/ghc-boot-th/ghc-boot-th.cabal.in
+++ b/libraries/ghc-boot-th/ghc-boot-th.cabal.in
@@ -29,6 +29,7 @@ source-repository head
Library
default-language: Haskell2010
other-extensions: DeriveGeneric
+ default-extensions: NoImplicitPrelude
exposed-modules:
GHC.LanguageExtensions.Type
diff --git a/libraries/ghc-boot/GHC/HandleEncoding.hs b/libraries/ghc-boot/GHC/HandleEncoding.hs
index aaa1689782..3c4c10c70f 100644
--- a/libraries/ghc-boot/GHC/HandleEncoding.hs
+++ b/libraries/ghc-boot/GHC/HandleEncoding.hs
@@ -1,6 +1,7 @@
-- | See GHC #10762 and #15021.
module GHC.HandleEncoding (configureHandleEncoding) where
+import Prelude -- See note [Why do we import Prelude here?]
import GHC.IO.Encoding (textEncodingName)
import System.Environment
import System.IO
diff --git a/libraries/ghc-boot/GHC/PackageDb.hs b/libraries/ghc-boot/GHC/PackageDb.hs
index 0bce7001cd..5de3a5fc74 100644
--- a/libraries/ghc-boot/GHC/PackageDb.hs
+++ b/libraries/ghc-boot/GHC/PackageDb.hs
@@ -64,6 +64,7 @@ module GHC.PackageDb (
writePackageDb
) where
+import Prelude -- See note [Why do we import Prelude here?]
import Data.Version (Version(..))
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BS.Char8
diff --git a/libraries/ghc-boot/GHC/Serialized.hs b/libraries/ghc-boot/GHC/Serialized.hs
index ea5dba7624..deb1a48edd 100644
--- a/libraries/ghc-boot/GHC/Serialized.hs
+++ b/libraries/ghc-boot/GHC/Serialized.hs
@@ -18,6 +18,7 @@ module GHC.Serialized (
serializeWithData, deserializeWithData,
) where
+import Prelude -- See note [Why do we import Prelude here?]
import Data.Bits
import Data.Word ( Word8 )
import Data.Data
diff --git a/libraries/ghc-boot/ghc-boot.cabal.in b/libraries/ghc-boot/ghc-boot.cabal.in
index 0ca9c1ec73..58311b6ab9 100644
--- a/libraries/ghc-boot/ghc-boot.cabal.in
+++ b/libraries/ghc-boot/ghc-boot.cabal.in
@@ -34,6 +34,7 @@ source-repository head
Library
default-language: Haskell2010
other-extensions: DeriveGeneric, RankNTypes, ScopedTypeVariables
+ default-extensions: NoImplicitPrelude
exposed-modules:
GHC.LanguageExtensions
diff --git a/libraries/ghc-heap/GHC/Exts/Heap.hs b/libraries/ghc-heap/GHC/Exts/Heap.hs
index 535596fda5..16b00e0dfb 100644
--- a/libraries/ghc-heap/GHC/Exts/Heap.hs
+++ b/libraries/ghc-heap/GHC/Exts/Heap.hs
@@ -45,6 +45,7 @@ module GHC.Exts.Heap (
, areBoxesEqual
) where
+import Prelude
import GHC.Exts.Heap.Closures
import GHC.Exts.Heap.ClosureTypes
import GHC.Exts.Heap.Constants
diff --git a/libraries/ghc-heap/GHC/Exts/Heap/ClosureTypes.hs b/libraries/ghc-heap/GHC/Exts/Heap/ClosureTypes.hs
index 677e3b64e7..1d25abee51 100644
--- a/libraries/ghc-heap/GHC/Exts/Heap/ClosureTypes.hs
+++ b/libraries/ghc-heap/GHC/Exts/Heap/ClosureTypes.hs
@@ -6,6 +6,7 @@ module GHC.Exts.Heap.ClosureTypes
, closureTypeHeaderSize
) where
+import Prelude -- See note [Why do we import Prelude here?]
import GHC.Generics
{- ---------------------------------------------
diff --git a/libraries/ghc-heap/GHC/Exts/Heap/Closures.hs b/libraries/ghc-heap/GHC/Exts/Heap/Closures.hs
index bdfac8bf8b..facb801a97 100644
--- a/libraries/ghc-heap/GHC/Exts/Heap/Closures.hs
+++ b/libraries/ghc-heap/GHC/Exts/Heap/Closures.hs
@@ -20,6 +20,7 @@ module GHC.Exts.Heap.Closures (
, asBox
) where
+import Prelude -- See note [Why do we import Prelude here?]
import GHC.Exts.Heap.Constants
#if defined(PROFILING)
import GHC.Exts.Heap.InfoTableProf
diff --git a/libraries/ghc-heap/GHC/Exts/Heap/Constants.hsc b/libraries/ghc-heap/GHC/Exts/Heap/Constants.hsc
index 757e76ce23..2b57c13489 100644
--- a/libraries/ghc-heap/GHC/Exts/Heap/Constants.hsc
+++ b/libraries/ghc-heap/GHC/Exts/Heap/Constants.hsc
@@ -8,6 +8,7 @@ module GHC.Exts.Heap.Constants
#include "MachDeps.h"
+import Prelude -- See note [Why do we import Prelude here?]
import Data.Bits
wORD_SIZE, tAG_MASK, wORD_SIZE_IN_BITS :: Int
diff --git a/libraries/ghc-heap/GHC/Exts/Heap/InfoTable.hsc b/libraries/ghc-heap/GHC/Exts/Heap/InfoTable.hsc
index d6f1ab0e95..25fe4982aa 100644
--- a/libraries/ghc-heap/GHC/Exts/Heap/InfoTable.hsc
+++ b/libraries/ghc-heap/GHC/Exts/Heap/InfoTable.hsc
@@ -7,6 +7,7 @@ module GHC.Exts.Heap.InfoTable
#include "Rts.h"
+import Prelude -- See note [Why do we import Prelude here?]
import GHC.Exts.Heap.InfoTable.Types
#if !defined(TABLES_NEXT_TO_CODE)
import GHC.Exts.Heap.Constants
diff --git a/libraries/ghc-heap/GHC/Exts/Heap/InfoTable/Types.hsc b/libraries/ghc-heap/GHC/Exts/Heap/InfoTable/Types.hsc
index 0ba535d039..9a19360183 100644
--- a/libraries/ghc-heap/GHC/Exts/Heap/InfoTable/Types.hsc
+++ b/libraries/ghc-heap/GHC/Exts/Heap/InfoTable/Types.hsc
@@ -8,6 +8,7 @@ module GHC.Exts.Heap.InfoTable.Types
#include "Rts.h"
+import Prelude -- See note [Why do we import Prelude here?]
import GHC.Generics
import GHC.Exts.Heap.ClosureTypes
import Foreign
diff --git a/libraries/ghc-heap/GHC/Exts/Heap/InfoTableProf.hsc b/libraries/ghc-heap/GHC/Exts/Heap/InfoTableProf.hsc
index cd030bfa1a..56d7caae70 100644
--- a/libraries/ghc-heap/GHC/Exts/Heap/InfoTableProf.hsc
+++ b/libraries/ghc-heap/GHC/Exts/Heap/InfoTableProf.hsc
@@ -11,6 +11,7 @@ module GHC.Exts.Heap.InfoTableProf
#define PROFILING
#include "Rts.h"
+import Prelude -- See note [Why do we import Prelude here?]
import GHC.Exts.Heap.InfoTable.Types
#if !defined(TABLES_NEXT_TO_CODE)
import GHC.Exts.Heap.Constants
diff --git a/libraries/ghc-heap/GHC/Exts/Heap/Utils.hsc b/libraries/ghc-heap/GHC/Exts/Heap/Utils.hsc
index 3f09700225..fab56d54d5 100644
--- a/libraries/ghc-heap/GHC/Exts/Heap/Utils.hsc
+++ b/libraries/ghc-heap/GHC/Exts/Heap/Utils.hsc
@@ -6,6 +6,7 @@ module GHC.Exts.Heap.Utils (
#include "Rts.h"
+import Prelude -- See note [Why do we import Prelude here?]
import GHC.Exts.Heap.Constants
import GHC.Exts.Heap.InfoTable
diff --git a/libraries/ghc-heap/ghc-heap.cabal.in b/libraries/ghc-heap/ghc-heap.cabal.in
index 6f9bd2d756..386c984222 100644
--- a/libraries/ghc-heap/ghc-heap.cabal.in
+++ b/libraries/ghc-heap/ghc-heap.cabal.in
@@ -28,6 +28,9 @@ library
ghc-options: -Wall
cmm-sources: cbits/HeapPrim.cmm
+
+ default-extensions: NoImplicitPrelude
+
exposed-modules: GHC.Exts.Heap
GHC.Exts.Heap.Closures
GHC.Exts.Heap.ClosureTypes
diff --git a/libraries/ghci/GHCi/BinaryArray.hs b/libraries/ghci/GHCi/BinaryArray.hs
index 9529744b33..5431d6aa96 100644
--- a/libraries/ghci/GHCi/BinaryArray.hs
+++ b/libraries/ghci/GHCi/BinaryArray.hs
@@ -5,6 +5,7 @@
--
module GHCi.BinaryArray(putArray, getArray) where
+import Prelude
import Foreign.Ptr
import Data.Binary
import Data.Binary.Put (putBuilder)
diff --git a/libraries/ghci/GHCi/BreakArray.hs b/libraries/ghci/GHCi/BreakArray.hs
index bece43bdb9..8d0e7495ba 100644
--- a/libraries/ghci/GHCi/BreakArray.hs
+++ b/libraries/ghci/GHCi/BreakArray.hs
@@ -30,6 +30,7 @@ module GHCi.BreakArray
) where
#ifdef GHCI
+import Prelude -- See note [Why do we import Prelude here?]
import Control.Monad
import Data.Word
import GHC.Word
diff --git a/libraries/ghci/GHCi/CreateBCO.hs b/libraries/ghci/GHCi/CreateBCO.hs
index ca7726ccff..3ebcf0ea22 100644
--- a/libraries/ghci/GHCi/CreateBCO.hs
+++ b/libraries/ghci/GHCi/CreateBCO.hs
@@ -13,6 +13,7 @@
-- | Create real byte-code objects from 'ResolvedBCO's.
module GHCi.CreateBCO (createBCOs) where
+import Prelude -- See note [Why do we import Prelude here?]
import GHCi.ResolvedBCO
import GHCi.RemoteTypes
import GHCi.BreakArray
diff --git a/libraries/ghci/GHCi/FFI.hsc b/libraries/ghci/GHCi/FFI.hsc
index 7fd75bb8e4..f88e9e8bd8 100644
--- a/libraries/ghci/GHCi/FFI.hsc
+++ b/libraries/ghci/GHCi/FFI.hsc
@@ -17,6 +17,7 @@ module GHCi.FFI
, freeForeignCallInfo
) where
+import Prelude -- See note [Why do we import Prelude here?]
import Control.Exception
import Data.Binary
import GHC.Generics
diff --git a/libraries/ghci/GHCi/InfoTable.hsc b/libraries/ghci/GHCi/InfoTable.hsc
index ca5757257c..ec3c18ae06 100644
--- a/libraries/ghci/GHCi/InfoTable.hsc
+++ b/libraries/ghci/GHCi/InfoTable.hsc
@@ -15,6 +15,7 @@ module GHCi.InfoTable
#endif
) where
+import Prelude -- See note [Why do we import Prelude here?]
#ifdef GHCI
import Foreign
import Foreign.C
diff --git a/libraries/ghci/GHCi/Message.hs b/libraries/ghci/GHCi/Message.hs
index 9b6740cc51..012dd884ba 100644
--- a/libraries/ghci/GHCi/Message.hs
+++ b/libraries/ghci/GHCi/Message.hs
@@ -22,6 +22,7 @@ module GHCi.Message
, Pipe(..), remoteCall, remoteTHCall, readPipe, writePipe
) where
+import Prelude -- See note [Why do we import Prelude here?]
import GHCi.RemoteTypes
import GHCi.FFI
import GHCi.TH.Binary ()
diff --git a/libraries/ghci/GHCi/ObjLink.hs b/libraries/ghci/GHCi/ObjLink.hs
index 0d7b2aeff8..8c9f75b9f9 100644
--- a/libraries/ghci/GHCi/ObjLink.hs
+++ b/libraries/ghci/GHCi/ObjLink.hs
@@ -25,6 +25,7 @@ module GHCi.ObjLink
, findSystemLibrary
) where
+import Prelude -- See note [Why do we import Prelude here?]
import GHCi.RemoteTypes
import Control.Exception (throwIO, ErrorCall(..))
import Control.Monad ( when )
diff --git a/libraries/ghci/GHCi/RemoteTypes.hs b/libraries/ghci/GHCi/RemoteTypes.hs
index 12ae529b16..c024ae9fff 100644
--- a/libraries/ghci/GHCi/RemoteTypes.hs
+++ b/libraries/ghci/GHCi/RemoteTypes.hs
@@ -17,6 +17,7 @@ module GHCi.RemoteTypes
, unsafeForeignRefToRemoteRef, finalizeForeignRef
) where
+import Prelude -- See note [Why do we import Prelude here?]
import Control.DeepSeq
import Data.Word
import Foreign hiding (newForeignPtr)
diff --git a/libraries/ghci/GHCi/ResolvedBCO.hs b/libraries/ghci/GHCi/ResolvedBCO.hs
index f56ee6d6d9..5942d37b10 100644
--- a/libraries/ghci/GHCi/ResolvedBCO.hs
+++ b/libraries/ghci/GHCi/ResolvedBCO.hs
@@ -6,6 +6,7 @@ module GHCi.ResolvedBCO
, isLittleEndian
) where
+import Prelude -- See note [Why do we import Prelude here?]
import SizedSeq
import GHCi.RemoteTypes
import GHCi.BreakArray
diff --git a/libraries/ghci/GHCi/Run.hs b/libraries/ghci/GHCi/Run.hs
index 8ec7659abe..72099b205f 100644
--- a/libraries/ghci/GHCi/Run.hs
+++ b/libraries/ghci/GHCi/Run.hs
@@ -12,6 +12,7 @@ module GHCi.Run
( run, redirectInterrupts
) where
+import Prelude -- See note [Why do we import Prelude here?]
import GHCi.CreateBCO
import GHCi.InfoTable
import GHCi.FFI
diff --git a/libraries/ghci/GHCi/Signals.hs b/libraries/ghci/GHCi/Signals.hs
index 629f116a0e..dc3b297dc5 100644
--- a/libraries/ghci/GHCi/Signals.hs
+++ b/libraries/ghci/GHCi/Signals.hs
@@ -1,6 +1,7 @@
{-# LANGUAGE CPP #-}
module GHCi.Signals (installSignalHandlers) where
+import Prelude -- See note [Why do we import Prelude here?]
import Control.Concurrent
import Control.Exception
import System.Mem.Weak ( deRefWeak )
diff --git a/libraries/ghci/GHCi/StaticPtrTable.hs b/libraries/ghci/GHCi/StaticPtrTable.hs
index d23e810f8a..623e8ef307 100644
--- a/libraries/ghci/GHCi/StaticPtrTable.hs
+++ b/libraries/ghci/GHCi/StaticPtrTable.hs
@@ -3,6 +3,7 @@
module GHCi.StaticPtrTable ( sptAddEntry ) where
+import Prelude -- See note [Why do we import Prelude here?]
import Data.Word
import Foreign
import GHC.Fingerprint
diff --git a/libraries/ghci/GHCi/TH.hs b/libraries/ghci/GHCi/TH.hs
index aebc32c03a..5779b5073e 100644
--- a/libraries/ghci/GHCi/TH.hs
+++ b/libraries/ghci/GHCi/TH.hs
@@ -91,6 +91,7 @@ Other Notes on TH / Remote GHCi
compiler/typecheck/TcSplice.hs
-}
+import Prelude -- See note [Why do we import Prelude here?]
import GHCi.Message
import GHCi.RemoteTypes
import GHC.Serialized
diff --git a/libraries/ghci/GHCi/TH/Binary.hs b/libraries/ghci/GHCi/TH/Binary.hs
index 4cda7f2d21..22a2847660 100644
--- a/libraries/ghci/GHCi/TH/Binary.hs
+++ b/libraries/ghci/GHCi/TH/Binary.hs
@@ -7,6 +7,7 @@
-- This module is full of orphans, unfortunately
module GHCi.TH.Binary () where
+import Prelude -- See note [Why do we import Prelude here?]
import Data.Binary
import qualified Data.ByteString as B
import GHC.Serialized
diff --git a/libraries/ghci/SizedSeq.hs b/libraries/ghci/SizedSeq.hs
index 55433c2fbd..f83e14081f 100644
--- a/libraries/ghci/SizedSeq.hs
+++ b/libraries/ghci/SizedSeq.hs
@@ -8,6 +8,7 @@ module SizedSeq
, sizeSS
) where
+import Prelude -- See note [Why do we import Prelude here?]
import Control.DeepSeq
import Data.Binary
import Data.List
diff --git a/libraries/ghci/ghci.cabal.in b/libraries/ghci/ghci.cabal.in
index 32ce79c013..f49acf5665 100644
--- a/libraries/ghci/ghci.cabal.in
+++ b/libraries/ghci/ghci.cabal.in
@@ -29,6 +29,7 @@ source-repository head
library
default-language: Haskell2010
+ default-extensions: NoImplicitPrelude
other-extensions:
BangPatterns
CPP