[project @ 2001-02-22 16:10:12 by rrt]
[ghc-hetmet.git] / ghc / lib / std / Array.lhs
index 9c32f4a..d3cee48 100644 (file)
@@ -1,7 +1,8 @@
+% -----------------------------------------------------------------------------
+% $Id: Array.lhs,v 1.15 2000/11/08 15:54:05 simonpj Exp $
 %
-% (c) The AQUA Project, Glasgow University, 1994-1999
+% (c) The University of Glasgow, 1994-2000
 %
-
 \section[Array]{Module @Array@}
 
 \begin{code}
@@ -39,28 +40,33 @@ module  Array
     ) where
 
 #ifndef __HUGS__
+       ------------ GHC --------------------
 import Ix
 import PrelList
-import PrelShow
 import PrelArr         -- Most of the hard work is done here
 import PrelBase
+       ------------ End of GHC --------------------
+
+
 #else
-import privileged Prelude ( PrimArray
-                         , runST
-                         , primNewArray
-                         , primWriteArray
-                         , primReadArray
-                         , primUnsafeFreezeArray
-                         , primIndexArray
-                         )
+       ------------ HUGS --------------------
+import PrelPrim ( PrimArray
+               , runST
+               , primNewArray
+               , primWriteArray
+               , primReadArray
+               , primUnsafeFreezeArray
+               , primIndexArray
+               )
 import Ix
 import List( (\\) )
-#endif
 
 infixl 9  !, //
+       ------------ End of HUGS --------------------
+#endif
+
 \end{code}
 
-#ifndef __HUGS__
 
 
 %*********************************************************
@@ -69,9 +75,10 @@ infixl 9  !, //
 %*                                                     *
 %*********************************************************
 
-\begin{code}
-
+#ifndef __HUGS__
+       ------------ GHC --------------------
 
+\begin{code}
 {-# SPECIALISE listArray :: (Int,Int) -> [b] -> Array Int b #-}
 listArray            :: (Ix a) => (a,a) -> [b] -> Array a b
 listArray b vs       =  array b (zip (range b) vs)
@@ -84,6 +91,9 @@ ixmap               :: (Ix a, Ix b) => (a,a) -> (a -> b) -> Array b c -> Array a c
 ixmap b f a           =  array b [(i, a ! f i) | i <- range b]
 \end{code}
 
+       ------------ End of GHC --------------------
+#else
+
 
 %*********************************************************
 %*                                                     *
@@ -91,8 +101,8 @@ ixmap b f a           =  array b [(i, a ! f i) | i <- range b]
 %*                                                     *
 %*********************************************************
 
+       ------------ HUGS (rest of file) --------------------
 
-#else
 \begin{code}
 data Array ix elt = Array (ix,ix) (PrimArray elt)
 
@@ -126,7 +136,7 @@ assocs                :: Ix a => Array a b -> [(a,b)]
 assocs a          =  [(i, a!i) | i <- indices a]
 
 (//)              :: Ix a => Array a b -> [(a,b)] -> Array a b
-a // us           =  array (bounds a)
+(//) a us           =  array (bounds a)
                         ([(i,a!i) | i <- indices a \\ [i | (i,_) <- us]]
                          ++ us)