From 5e70ec8f27f4f62d9f1137e931b4d64d37eb221e Mon Sep 17 00:00:00 2001 From: "simonpj@microsoft" Date: Thu, 3 May 2007 12:30:10 +0000 Subject: [PATCH] Trim imports, remove a cycle A first attempt at removing gratuitous cycles in the base package. I've removed the useless module GHC.Dynamic, which gets rid of a cycle; and trimmed off various unnecesary imports. This also fixes the IsString import problem. --- Data/Typeable.hs | 4 ++++ Data/Typeable.hs-boot | 6 ++++-- Foreign/Ptr.hs | 1 - Foreign/StablePtr.hs | 1 - Foreign/Storable.hs | 1 - Foreign/Storable.hs-boot | 1 - GHC/Dynamic.hs | 11 ----------- GHC/Dynamic.hs-boot | 10 ---------- GHC/Exts.hs | 1 + GHC/ForeignPtr.hs | 6 ++---- GHC/IOBase.lhs | 3 ++- GHC/Storable.lhs | 3 +-- base.cabal | 1 - 13 files changed, 14 insertions(+), 35 deletions(-) delete mode 100644 GHC/Dynamic.hs delete mode 100644 GHC/Dynamic.hs-boot diff --git a/Data/Typeable.hs b/Data/Typeable.hs index d187296..7a8b733 100644 --- a/Data/Typeable.hs +++ b/Data/Typeable.hs @@ -40,6 +40,7 @@ module Data.Typeable -- * Type representations TypeRep, -- abstract, instance of: Eq, Show, Typeable TyCon, -- abstract, instance of: Eq, Show, Typeable + showsTypeRep, -- * Construction of type representations mkTyCon, -- :: String -> TyCon @@ -280,6 +281,9 @@ instance Show TypeRep where showChar ' ' . showArgs tys +showsTypeRep :: TypeRep -> ShowS +showsTypeRep = shows + instance Show TyCon where showsPrec _ (TyCon _ s) = showString s diff --git a/Data/Typeable.hs-boot b/Data/Typeable.hs-boot index 5a2989c..d9bc373 100644 --- a/Data/Typeable.hs-boot +++ b/Data/Typeable.hs-boot @@ -4,12 +4,14 @@ module Data.Typeable where import GHC.Base +import GHC.Show data TypeRep data TyCon -mkTyCon :: String -> TyCon -mkTyConApp :: TyCon -> [TypeRep] -> TypeRep +mkTyCon :: String -> TyCon +mkTyConApp :: TyCon -> [TypeRep] -> TypeRep +showsTypeRep :: TypeRep -> ShowS class Typeable a where typeOf :: a -> TypeRep diff --git a/Foreign/Ptr.hs b/Foreign/Ptr.hs index 6467c38..23706a8 100644 --- a/Foreign/Ptr.hs +++ b/Foreign/Ptr.hs @@ -65,7 +65,6 @@ import Data.Word import Foreign.C.Types #endif -import Control.Monad ( liftM ) import Data.Bits import Data.Typeable ( Typeable(..), mkTyCon, mkTyConApp ) import Foreign.Storable ( Storable(..) ) diff --git a/Foreign/StablePtr.hs b/Foreign/StablePtr.hs index 9554060..8ebdcfe 100644 --- a/Foreign/StablePtr.hs +++ b/Foreign/StablePtr.hs @@ -30,7 +30,6 @@ module Foreign.StablePtr #ifdef __GLASGOW_HASKELL__ import GHC.Stable -import GHC.Err #endif #ifdef __HUGS__ diff --git a/Foreign/Storable.hs b/Foreign/Storable.hs index c48746b..3f05449 100644 --- a/Foreign/Storable.hs +++ b/Foreign/Storable.hs @@ -45,7 +45,6 @@ import GHC.Stable ( StablePtr ) import GHC.Num import GHC.Int import GHC.Word -import GHC.Stable import GHC.Ptr import GHC.Float import GHC.Err diff --git a/Foreign/Storable.hs-boot b/Foreign/Storable.hs-boot index 12d256c..35374b5 100644 --- a/Foreign/Storable.hs-boot +++ b/Foreign/Storable.hs-boot @@ -5,7 +5,6 @@ module Foreign.Storable where import GHC.Float import GHC.Int -import GHC.Num import GHC.Word class Storable a diff --git a/GHC/Dynamic.hs b/GHC/Dynamic.hs deleted file mode 100644 index e86b027..0000000 --- a/GHC/Dynamic.hs +++ /dev/null @@ -1,11 +0,0 @@ -{-# OPTIONS -fno-implicit-prelude #-} -module GHC.Dynamic ( - Dynamic, TypeRep, dynTypeRep, showsTypeRep - ) where - -import Data.Dynamic ( Dynamic, dynTypeRep ) -import Data.Typeable ( TypeRep ) -import GHC.Show ( ShowS, shows ) - -showsTypeRep :: TypeRep -> ShowS -showsTypeRep = shows diff --git a/GHC/Dynamic.hs-boot b/GHC/Dynamic.hs-boot deleted file mode 100644 index a926421..0000000 --- a/GHC/Dynamic.hs-boot +++ /dev/null @@ -1,10 +0,0 @@ -{-# OPTIONS -fno-implicit-prelude #-} -module GHC.Dynamic ( - Dynamic, TypeRep, dynTypeRep, showsTypeRep - ) where - -import {-# SOURCE #-} Data.Dynamic ( Dynamic, dynTypeRep ) -import {-# SOURCE #-} Data.Typeable ( TypeRep ) -import GHC.Show ( ShowS ) - -showsTypeRep :: TypeRep -> ShowS diff --git a/GHC/Exts.hs b/GHC/Exts.hs index 5205456..d4e3856 100644 --- a/GHC/Exts.hs +++ b/GHC/Exts.hs @@ -44,4 +44,5 @@ import GHC.Word import GHC.Num import GHC.Float import GHC.Ptr +import Data.String diff --git a/GHC/ForeignPtr.hs b/GHC/ForeignPtr.hs index bb74f0b..dc1f02f 100644 --- a/GHC/ForeignPtr.hs +++ b/GHC/ForeignPtr.hs @@ -34,15 +34,13 @@ module GHC.ForeignPtr import Control.Monad ( sequence_ ) import Foreign.Storable -import Numeric ( showHex ) import GHC.Show -import GHC.Num -import GHC.List ( null, replicate, length ) +import GHC.List ( null ) import GHC.Base import GHC.IOBase import GHC.STRef ( STRef(..) ) -import GHC.Ptr ( Ptr(..), FunPtr, castFunPtrToPtr ) +import GHC.Ptr ( Ptr(..), FunPtr ) import GHC.Err -- |The type 'ForeignPtr' represents references to objects that are diff --git a/GHC/IOBase.lhs b/GHC/IOBase.lhs index 1dee45f..32c7941 100644 --- a/GHC/IOBase.lhs +++ b/GHC/IOBase.lhs @@ -58,7 +58,8 @@ import GHC.Read import Foreign.C.Types (CInt) #ifndef __HADDOCK__ -import {-# SOURCE #-} GHC.Dynamic +import {-# SOURCE #-} Data.Typeable ( showsTypeRep ) +import {-# SOURCE #-} Data.Dynamic ( Dynamic, dynTypeRep ) #endif -- --------------------------------------------------------------------------- diff --git a/GHC/Storable.lhs b/GHC/Storable.lhs index 3a53f4b..de7cf67 100644 --- a/GHC/Storable.lhs +++ b/GHC/Storable.lhs @@ -50,10 +50,9 @@ module GHC.Storable , writeWord64OffPtr ) where -import GHC.Stable ( StablePtr ) +import GHC.Stable ( StablePtr(..) ) import GHC.Int import GHC.Word -import GHC.Stable import GHC.Ptr import GHC.Float import GHC.IOBase diff --git a/base.cabal b/base.cabal index 2153529..f4fd2fe 100644 --- a/base.cabal +++ b/base.cabal @@ -107,7 +107,6 @@ exposed-modules: GHC.Conc, GHC.ConsoleHandler, GHC.Dotnet, - GHC.Dynamic, GHC.Enum, GHC.Err, GHC.Exception, -- 1.7.10.4