Hugs only: don't import exception types -- their instances are now in Control.Excepti...
[ghc-base.git] / Data / Typeable.hs
index 4614ab5..606c8cc 100644 (file)
@@ -83,7 +83,6 @@ module Data.Typeable
 
 import qualified Data.HashTable as HT
 import Data.Maybe
-import Data.Either
 import Data.Int
 import Data.Word
 import Data.List( foldl, intersperse )
@@ -91,35 +90,30 @@ import Unsafe.Coerce
 
 #ifdef __GLASGOW_HASKELL__
 import GHC.Base
-import GHC.Show
-import GHC.Err
-import GHC.Num
-import GHC.Float
+import GHC.Show         (Show(..), ShowS,
+                         shows, showString, showChar, showParen)
+import GHC.Err          (undefined)
+import GHC.Num          (Integer, fromInteger, (+))
 import GHC.Real         ( rem, Ratio )
 import GHC.IOBase       (IORef,newIORef,unsafePerformIO)
 
 -- These imports are so we can define Typeable instances
 -- It'd be better to give Typeable instances in the modules themselves
 -- but they all have to be compiled before Typeable
-import GHC.IOBase       ( IO, MVar, Exception, ArithException, IOException, 
-                          ArrayException, AsyncException, Handle )
+import GHC.IOBase       ( IO, MVar, Handle, block )
 import GHC.ST           ( ST )
 import GHC.STRef        ( STRef )
 import GHC.Ptr          ( Ptr, FunPtr )
-import GHC.ForeignPtr   ( ForeignPtr )
 import GHC.Stable       ( StablePtr, newStablePtr, freeStablePtr,
                           deRefStablePtr, castStablePtrToPtr,
                           castPtrToStablePtr )
-import GHC.Exception    ( block )
 import GHC.Arr          ( Array, STArray )
 
 #endif
 
 #ifdef __HUGS__
 import Hugs.Prelude     ( Key(..), TypeRep(..), TyCon(..), Ratio,
-                          Exception, ArithException, IOException,
-                          ArrayException, AsyncException, Handle,
-                          Ptr, FunPtr, ForeignPtr, StablePtr )
+                          Handle, Ptr, FunPtr, ForeignPtr, StablePtr )
 import Hugs.IORef       ( IORef, newIORef, readIORef, writeIORef )
 import Hugs.IOExts      ( unsafePerformIO )
         -- For the Typeable instance
@@ -489,18 +483,12 @@ INSTANCE_TYPEABLE0((),unitTc,"()")
 INSTANCE_TYPEABLE1([],listTc,"[]")
 INSTANCE_TYPEABLE1(Maybe,maybeTc,"Maybe")
 INSTANCE_TYPEABLE1(Ratio,ratioTc,"Ratio")
-INSTANCE_TYPEABLE2(Either,eitherTc,"Either")
 INSTANCE_TYPEABLE2((->),funTc,"->")
 INSTANCE_TYPEABLE1(IO,ioTc,"IO")
 
 #if defined(__GLASGOW_HASKELL__) || defined(__HUGS__)
 -- Types defined in GHC.IOBase
 INSTANCE_TYPEABLE1(MVar,mvarTc,"MVar" )
-INSTANCE_TYPEABLE0(Exception,exceptionTc,"Exception")
-INSTANCE_TYPEABLE0(IOException,ioExceptionTc,"IOException")
-INSTANCE_TYPEABLE0(ArithException,arithExceptionTc,"ArithException")
-INSTANCE_TYPEABLE0(ArrayException,arrayExceptionTc,"ArrayException")
-INSTANCE_TYPEABLE0(AsyncException,asyncExceptionTc,"AsyncException")
 #endif
 
 -- Types defined in GHC.Arr
@@ -524,30 +512,29 @@ tup4Tc :: TyCon
 tup4Tc = mkTyCon "(,,,)"
 
 instance Typeable4 (,,,) where
-  typeOf4 tu = mkTyConApp tup4Tc []
+  typeOf4 _ = mkTyConApp tup4Tc []
 
 tup5Tc :: TyCon
 tup5Tc = mkTyCon "(,,,,)"
 
 instance Typeable5 (,,,,) where
-  typeOf5 tu = mkTyConApp tup5Tc []
+  typeOf5 _ = mkTyConApp tup5Tc []
 
 tup6Tc :: TyCon
 tup6Tc = mkTyCon "(,,,,,)"
 
 instance Typeable6 (,,,,,) where
-  typeOf6 tu = mkTyConApp tup6Tc []
+  typeOf6 _ = mkTyConApp tup6Tc []
 
 tup7Tc :: TyCon
 tup7Tc = mkTyCon "(,,,,,,)"
 
 instance Typeable7 (,,,,,,) where
-  typeOf7 tu = mkTyConApp tup7Tc []
+  typeOf7 _ = mkTyConApp tup7Tc []
 #endif /* __NHC__ */
 
 INSTANCE_TYPEABLE1(Ptr,ptrTc,"Ptr")
 INSTANCE_TYPEABLE1(FunPtr,funPtrTc,"FunPtr")
-INSTANCE_TYPEABLE1(ForeignPtr,foreignPtrTc,"ForeignPtr")
 INSTANCE_TYPEABLE1(StablePtr,stablePtrTc,"StablePtr")
 INSTANCE_TYPEABLE1(IORef,iORefTc,"IORef")
 
@@ -636,7 +623,7 @@ cache = unsafePerformIO $ do
 
 newKey :: IORef Key -> IO Key
 #ifdef __GLASGOW_HASKELL__
-newKey kloc = do i <- genSym; return (Key i)
+newKey _ = do i <- genSym; return (Key i)
 #else
 newKey kloc = do { k@(Key i) <- readIORef kloc ;
                    writeIORef kloc (Key (i+1)) ;