[project @ 2002-09-20 13:15:07 by ross]
[ghc-base.git] / Data / Array / IO.hs
index 9074a2a..82b6a22 100644 (file)
@@ -46,8 +46,6 @@ import Hugs.IOArray
 #endif
 
 #ifdef __GLASGOW_HASKELL__
--- GHC only to the end of file
-
 import Foreign.C
 import Foreign.Ptr             ( Ptr, FunPtr )
 import Foreign.StablePtr       ( StablePtr )
@@ -63,6 +61,27 @@ import GHC.Handle
 import GHC.Conc
 
 import GHC.Base
+#endif /* __GLASGOW_HASKELL__ */
+
+#ifdef __HUGS__
+instance HasBounds IOArray where
+    bounds = boundsIOArray
+
+instance MArray IOArray e IO where
+    newArray    = newIOArray
+    unsafeRead  = unsafeReadIOArray
+    unsafeWrite = unsafeWriteIOArray
+#endif /* __HUGS__ */
+
+iOArrayTc :: TyCon
+iOArrayTc = mkTyCon "IOArray"
+
+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)]
+
+#ifdef __GLASGOW_HASKELL__
+-- GHC only to the end of file
 
 -----------------------------------------------------------------------------
 -- | Mutable, boxed, non-strict arrays in the 'IO' monad.  The type
@@ -74,13 +93,6 @@ import GHC.Base
 --
 newtype IOArray i e = IOArray (STArray RealWorld i e) deriving Eq
 
-iOArrayTc :: TyCon
-iOArrayTc = mkTyCon "IOArray"
-
-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 HasBounds IOArray where
     {-# INLINE bounds #-}
     bounds (IOArray marr) = bounds marr