[project @ 2004-03-20 18:26:40 by ross]
authorross <unknown>
Sat, 20 Mar 2004 18:26:41 +0000 (18:26 +0000)
committerross <unknown>
Sat, 20 Mar 2004 18:26:41 +0000 (18:26 +0000)
change instances of Typeable to macros

Control/Monad/ST.hs
Data/Array/Base.hs
Data/Array/IO/Internals.hs

index 705787e..5ea1052 100644 (file)
@@ -35,6 +35,8 @@ import Prelude
 import Control.Monad.Fix
 import Data.Typeable
 
+#include "Typeable.h"
+
 #ifdef __HUGS__
 import Hugs.ST
 import qualified Hugs.LazyST as LazyST
@@ -65,9 +67,4 @@ instance MonadFix (ST s) where
 -- ---------------------------------------------------------------------------
 -- Typeable instance
 
-sTTc :: TyCon
-sTTc = mkTyCon "ST"
-
-instance (Typeable a, Typeable b) => Typeable (ST a b) where
-  typeOf st = mkAppTy sTTc [typeOf ((undefined :: ST a b -> a) st),
-                           typeOf ((undefined :: ST a b -> b) st)]
+INSTANCE_TYPEABLE2(ST,sTTc,"ST")
index e5b6428..cb57dca 100644 (file)
@@ -1073,13 +1073,7 @@ instance MArray (STArray s) e (ST s) where
 -----------------------------------------------------------------------------
 -- Typeable instance for STArray
 
-sTArrayTc :: TyCon
-sTArrayTc = mkTyCon "STArray"
-
-instance (Typeable a, Typeable b, Typeable c) => Typeable (STArray a b c) where
-  typeOf a = mkAppTy sTArrayTc [typeOf ((undefined :: STArray a b c -> a) a),
-                               typeOf ((undefined :: STArray a b c -> b) a),
-                               typeOf ((undefined :: STArray a b c -> c) a)]
+INSTANCE_TYPEABLE3(STArray,sTArrayTc,"STArray")
 
 -----------------------------------------------------------------------------
 -- Flat unboxed mutable arrays (ST monad)
index 0f6d94e..0cf1901 100644 (file)
@@ -41,12 +41,9 @@ import GHC.IOBase
 import GHC.Base
 #endif /* __GLASGOW_HASKELL__ */
 
-iOArrayTc :: TyCon
-iOArrayTc = mkTyCon "IOArray"
+#include "Typeable.h"
 
-instance (Typeable a, Typeable b) => Typeable (IOArray a b) where
-  typeOf a = mkAppTy iOArrayTc [typeOf ((undefined :: IOArray a b -> a) a),
-                               typeOf ((undefined :: IOArray a b -> b) a)]
+INSTANCE_TYPEABLE2(IOArray,iOArrayTc,"IOArray")
 
 -----------------------------------------------------------------------------
 -- | Instance declarations for 'IOArray's
@@ -80,12 +77,7 @@ instance MArray IOArray e IO where
 --
 newtype IOUArray i e = IOUArray (STUArray RealWorld i e)
 
-iOUArrayTc :: TyCon
-iOUArrayTc = mkTyCon "IOUArray"
-
-instance (Typeable a, Typeable b) => Typeable (IOUArray a b) where
-  typeOf a = mkAppTy iOUArrayTc [typeOf ((undefined :: IOUArray a b -> a) a),
-                                typeOf ((undefined :: IOUArray a b -> b) a)]
+INSTANCE_TYPEABLE2(IOUArray,iOUArrayTc,"IOUArray")
 
 instance HasBounds IOUArray where
     {-# INLINE bounds #-}