[project @ 2002-07-22 11:37:38 by ross]
[ghc-base.git] / Data / Array / ST.hs
1 -----------------------------------------------------------------------------
2 -- |
3 -- Module      :  Data.Array.ST
4 -- Copyright   :  (c) The University of Glasgow 2001
5 -- License     :  BSD-style (see the file libraries/base/LICENSE)
6 -- 
7 -- Maintainer  :  libraries@haskell.org
8 -- Stability   :  experimental
9 -- Portability :  non-portable
10 --
11 -- Mutable boxed and unboxed arrays in the 'ST' monad.
12 --
13 -----------------------------------------------------------------------------
14
15 module Data.Array.ST (
16
17    -- * Boxed arrays
18    STArray,             -- instance of: Eq, MArray
19
20 #ifdef __GLASGOW_HASKELL__
21    -- * Unboxed arrays
22    STUArray,            -- instance of: Eq, MArray
23    castSTUArray,        -- :: STUArray s i a -> ST s (STUArray s i b)
24 #endif
25
26    -- * Overloaded mutable array interface
27    module Data.Array.MArray,
28  ) where
29
30 import Prelude
31
32 import Data.Array.MArray
33 #ifdef __HUGS__
34 import Hugs.ST
35 #else
36 import Data.Array.Base  hiding (MArray(..))
37 #endif
38
39 #ifdef __GLASGOW_HASKELL__
40 import GHC.Arr
41 import GHC.ST
42
43 -- | Casts an 'STUArray' with one element type into one with a
44 -- different element type.  All the elements of the resulting array
45 -- are undefined (unless you know what you\'re doing...).
46 castSTUArray :: STUArray s ix a -> ST s (STUArray s ix b)
47 castSTUArray (STUArray l u marr#) = return (STUArray l u marr#)
48 #endif