[project @ 2002-05-28 16:33:46 by simonmar]
[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    -- * Unboxed arrays
21    STUArray,            -- instance of: Eq, MArray
22    castSTUArray,        -- :: STUArray s i a -> ST s (STUArray s i b)
23
24    -- * Overloaded mutable array interface
25    module Data.Array.MArray,
26  ) where
27
28 import Prelude
29
30 import Data.Array.MArray
31 import Data.Array.Base  hiding (MArray(..))
32
33 #ifdef __GLASGOW_HASKELL__
34 import GHC.Arr
35 import GHC.ST
36
37 -- | Casts an 'STUArray' with one element type into one with a
38 -- different element type.  All the elements of the resulting array
39 -- are undefined (unless you know what you\'re doing...).
40 castSTUArray :: STUArray s ix a -> ST s (STUArray s ix b)
41 castSTUArray (STUArray l u marr#) = return (STUArray l u marr#)
42 #endif