[project @ 2002-06-06 16:03:16 by simonpj]
[ghc-base.git] / GHC / Arr.lhs
index bc8b809..dd8218c 100644 (file)
@@ -1,18 +1,18 @@
-% -----------------------------------------------------------------------------
-% $Id: Arr.lhs,v 1.2 2001/12/21 15:07:22 simonmar Exp $
-%
-% (c) The University of Glasgow, 1994-2000
-%
-
-\section[GHC.Arr]{Module @GHC.Arr@}
-
-Array implementation, @GHC.Arr@ exports the basic array
-types and operations.
-
-For byte-arrays see @GHC.ByteArr@.
-
 \begin{code}
 {-# OPTIONS -fno-implicit-prelude #-}
+-----------------------------------------------------------------------------
+-- |
+-- Module      :  GHC.Arr
+-- Copyright   :  (c) The University of Glasgow, 1994-2000
+-- License     :  see libraries/base/LICENSE
+-- 
+-- Maintainer  :  cvs-ghc@haskell.org
+-- Stability   :  internal
+-- Portability :  non-portable (GHC extensions)
+--
+-- GHC\'s array implementation.
+-- 
+-----------------------------------------------------------------------------
 
 module GHC.Arr where
 
@@ -278,7 +278,19 @@ instance  (Ix a1, Ix a2, Ix a3, Ix a4, Ix a5) => Ix (a1,a2,a3,a4,a5)  where
 type IPr = (Int, Int)
 
 data Ix i => Array     i e = Array   !i !i (Array# e)
-data Ix i => STArray s i e = STArray !i !i (MutableArray# s e)
+
+-- | Mutable, boxed, non-strict arrays in the 'ST' monad.  The type
+-- arguments are as follows:
+--
+--  * @s@: the state variable argument for the 'ST' type
+--
+--  * @i@: the index type of the array (should be an instance of @Ix@)
+--
+--  * @e@: the element type of the array.
+--
+data         STArray s i e = STArray !i !i (MutableArray# s e)
+       -- No Ix context for STArray.  They are stupid,
+       -- and force an Ix context on the equality instance.
 
 -- Just pointer equality on mutable arrays:
 instance Eq (STArray s i e) where
@@ -470,13 +482,7 @@ instance (Ix a, Show a, Show b) => Show (Array a b) where
         showChar ' ' .
         shows (assocs a)
 
-{-
-instance  (Ix a, Read a, Read b) => Read (Array a b)  where
-    readsPrec p = readParen (p > 9)
-          (\r -> [(array b as, u) | ("array",s) <- lex r,
-                                    (b,t)       <- reads s,
-                                    (as,u)      <- reads t   ])
--}
+-- The Read instance is in GHC.Read
 \end{code}