Commit b5930f8b authored by Herbert Valerio Riedel's avatar Herbert Valerio Riedel 🕺

Refactor module imports in base

This commit removes a couple of

  {-# OPTIONS_GHC -fno-warn-unused-imports #-}

by cleaning up the imports, as well as ensuring that all modules in the
GHC.* hierarchy avoid importing the `Prelude` module to clean-up the
import graph a bit.
parent d576fc38
......@@ -4,7 +4,6 @@
, UnboxedTuples
, ScopedTypeVariables
#-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-deprecations #-}
-- kludge for the Control.Concurrent.QSem, Control.Concurrent.QSemN
-- and Control.Concurrent.SampleVar imports.
......@@ -106,11 +105,9 @@ module Control.Concurrent (
import Control.Exception.Base as Exception
import GHC.Exception
import GHC.Conc hiding (threadWaitRead, threadWaitWrite,
threadWaitReadSTM, threadWaitWriteSTM)
import qualified GHC.Conc
import GHC.IO ( IO(..), unsafeInterleaveIO, unsafeUnmask )
import GHC.IO ( unsafeUnmask )
import GHC.IORef ( newIORef, readIORef, writeIORef )
import GHC.Base
......@@ -122,6 +119,8 @@ import Foreign.C.Types
import Foreign.C
import System.IO
import Data.Functor ( void )
#else
import qualified GHC.Conc
#endif
import Control.Concurrent.MVar
......
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- XXX -fno-warn-unused-imports needed for the GHC.Tuple import below. Sigh.
-----------------------------------------------------------------------------
-- |
......@@ -23,20 +21,9 @@ module Data.Tuple
, curry
, uncurry
, swap
)
where
) where
import GHC.Base
-- We need to depend on GHC.Base so that
-- a) so that we get GHC.Classes, GHC.Types
-- b) so that GHC.Base.inline is available, which is used
-- when expanding instance declarations
import GHC.Tuple
-- We must import GHC.Tuple, to ensure sure that the
-- data constructors of `(,)' are in scope when we do
-- the standalone deriving instance for Eq (a,b) etc
import GHC.Base () -- Note [Depend on GHC.Tuple]
default () -- Double isn't available yet
......
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE CPP #-}
......@@ -20,6 +21,8 @@
module GHC.ConsoleHandler
#if !defined(mingw32_HOST_OS) && !defined(__HADDOCK__)
where
import GHC.Base () -- dummy dependency
#else /* whole file */
( Handler(..)
, installHandler
......@@ -38,6 +41,7 @@ Note: this #include is inside a Haskell comment
by GHC
-}
import GHC.Base
import Foreign
import Foreign.C
import GHC.IO.FD
......
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE Trustworthy #-}
module GHC.Constants where
......@@ -6,3 +7,4 @@ module GHC.Constants where
-- We probably want to include the constants in platformConstants somehow
-- instead.
import GHC.Base () -- dummy dependency
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE CPP #-}
......@@ -5,6 +6,8 @@ module GHC.Environment (getFullArgs) where
import Foreign
import Foreign.C
import GHC.Base
import GHC.Real ( fromIntegral )
#ifdef mingw32_HOST_OS
import GHC.IO (finally)
......@@ -40,9 +43,8 @@ foreign import WINDOWS_CCONV unsafe "windows.h CommandLineToArgvW"
foreign import WINDOWS_CCONV unsafe "Windows.h LocalFree"
c_LocalFree :: Ptr a -> IO (Ptr a)
#else
import Control.Monad
import GHC.IO.Encoding
import GHC.Num
import qualified GHC.Foreign as GHC
getFullArgs :: IO [String]
......
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE Trustworthy #-}
-- ----------------------------------------------------------------------------
......
......@@ -39,7 +39,6 @@ import GHC.Read
import GHC.Arr
import GHC.Word hiding (uncheckedShiftL64#, uncheckedShiftRL64#)
import GHC.Show
import GHC.Float () -- for RealFrac methods
import Data.Typeable
......
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE ParallelArrays, MagicHash #-}
{-# OPTIONS_GHC -funbox-strict-fields #-}
......
{-# LANGUAGE NoImplicitPrelude #-}
-- | /Since: 4.7.0.0/
module GHC.Profiling where
import GHC.Base
foreign import ccall startProfTimer :: IO ()
foreign import ccall stopProfTimer :: IO ()
{-# LANGUAGE Safe #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE RecordWildCards #-}
{-# OPTIONS_GHC -funbox-strict-fields #-}
......@@ -19,6 +20,9 @@ module GHC.Stats
import Control.Monad
import Data.Int
import GHC.Base
import GHC.Read ( Read )
import GHC.Show ( Show )
import GHC.IO.Exception
import Foreign.Marshal.Alloc
import Foreign.Storable
......
......@@ -5,7 +5,6 @@
, MagicHash
, UnboxedTuples
#-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_HADDOCK hide #-}
-----------------------------------------------------------------------------
......@@ -34,23 +33,22 @@ module GHC.TopHandler (
import Control.Exception
import Data.Maybe
import Data.Dynamic (toDyn)
import Foreign
import Foreign.C
import GHC.Base
import GHC.Conc hiding (throwTo)
import GHC.Num
import GHC.Real
import GHC.MVar
import GHC.IO
import GHC.IO.Handle.FD
import GHC.IO.Handle
import GHC.IO.Exception
import GHC.Weak
import Data.Typeable
#if defined(mingw32_HOST_OS)
import GHC.ConsoleHandler
#else
import Data.Dynamic (toDyn)
#endif
-- | 'runMainIO' is wrapped around 'Main.main' (or whatever main is
......
......@@ -42,7 +42,6 @@ import GHC.Real
import GHC.Read
import GHC.Arr
import GHC.Show
import GHC.Float () -- for RealFrac methods
------------------------------------------------------------------------
-- type Word8
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment