[project @ 2001-06-28 14:15:04 by simonmar]
[packages/old-time.git] / Data / Array / MArray.hs
1 {-# OPTIONS -monly-3-regs #-}
2 -----------------------------------------------------------------------------
3 --
4 -- Module : Data.Array.MArray
5 -- Copyright : (c) The University of Glasgow 2001
6 -- License : BSD-style (see the file libraries/core/LICENSE)
7 --
8 -- Maintainer : libraries@haskell.org
9 -- Stability : experimental
10 -- Portability : non-portable
11 --
12 -- $Id: MArray.hs,v 1.1 2001/06/28 14:15:02 simonmar Exp $
13 --
14 -- Class of mutable arrays, and operations on them.
15 --
16 -----------------------------------------------------------------------------
17
18 module Data.Array.MArray (
19 module Data.Ix,
20
21 -- Class of mutable array types
22 MArray, -- :: (* -> * -> *) -> * -> (* -> *) -> class
23 -- Class of array types with immutable bounds
24 HasBounds, -- :: (* -> * -> *) -> class
25
26 newArray, -- :: (MArray a e m, Ix i) => (i,i) -> e -> m (a i e)
27 newArray_, -- :: (MArray a e m, Ix i) => (i,i) -> m (a i e)
28 newListArray, -- :: (MArray a e m, Ix i) => (i,i) -> [e] -> m (a i e)
29 readArray, -- :: (MArray a e m, Ix i) => a i e -> i -> m e
30 writeArray, -- :: (MArray a e m, Ix i) => a i e -> i -> e -> m ()
31 bounds, -- :: (HasBounds a, Ix i) => a i e -> (i,i)
32 indices, -- :: (HasBounds a, Ix i) => a i e -> [i]
33 getElems, -- :: (MArray a e m, Ix i) => a i e -> m [e]
34 getAssocs, -- :: (MArray a e m, Ix i) => a i e -> m [(i, e)]
35 mapArray, -- :: (MArray a e' m, MArray a e m, Ix i) => (e' -> e) -> a i e' -> m (a i e)
36 mapIndices, -- :: (MArray a e m, Ix i, Ix j) => (i,i) -> (i -> j) -> a j e -> m (a i e)
37
38 freeze, -- :: (Ix i, MArray a e m, IArray b e) => a i e -> m (b i e)
39 unsafeFreeze, -- :: (Ix i, MArray a e m, IArray b e) => a i e -> m (b i e)
40 thaw, -- :: (Ix i, IArray a e, MArray b e m) => a i e -> m (b i e)
41 unsafeThaw, -- :: (Ix i, IArray a e, MArray b e m) => a i e -> m (b i e)
42 ) where
43
44 import Prelude
45
46 import Data.Ix
47 import Data.Array.Base