From: ross Date: Sat, 20 Mar 2004 18:26:41 +0000 (+0000) Subject: [project @ 2004-03-20 18:26:40 by ross] X-Git-Tag: nhc98-1-18-release~341 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=037da109abc1f2fa1b33cf441663039751eaae46;p=ghc-base.git [project @ 2004-03-20 18:26:40 by ross] change instances of Typeable to macros --- diff --git a/Control/Monad/ST.hs b/Control/Monad/ST.hs index 705787e..5ea1052 100644 --- a/Control/Monad/ST.hs +++ b/Control/Monad/ST.hs @@ -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") diff --git a/Data/Array/Base.hs b/Data/Array/Base.hs index e5b6428..cb57dca 100644 --- a/Data/Array/Base.hs +++ b/Data/Array/Base.hs @@ -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) diff --git a/Data/Array/IO/Internals.hs b/Data/Array/IO/Internals.hs index 0f6d94e..0cf1901 100644 --- a/Data/Array/IO/Internals.hs +++ b/Data/Array/IO/Internals.hs @@ -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 #-}