[project @ 1997-03-14 05:24:00 by sof]
[ghc-hetmet.git] / ghc / lib / glaExts / MutableArray.lhs
1 %
2 % (c) The AQUA Project, Glasgow University, 1997
3 %
4 \section[MutableArray]{The @MutableArray@ interface}
5
6 Mutable (byte)arrays interface, re-exports type types and operations
7 over them from @ArrBase@. Have to be used in conjunction with
8 @ST@.
9
10 \begin{code}
11 module MutableArray 
12    (
13     MutableArray(..),        -- not abstract
14     MutableByteArray(..),
15
16     ST,
17     Ix,
18
19     -- Creators:
20     newArray,           -- :: Ix ix => (ix,ix) -> elt -> ST s (MutableArray s ix elt)
21     newCharArray,
22     newAddrArray,
23     newIntArray,
24     newFloatArray,
25     newDoubleArray,     -- :: Ix ix => (ix,ix) -> ST s (MutableByteArray s ix) 
26
27     boundsOfArray,      -- :: Ix ix => MutableArray s ix elt -> (ix, ix)  
28     boundsOfByteArray,  -- :: Ix ix => MutableByteArray s ix -> (ix, ix)
29
30     readArray,          -- :: Ix ix => MutableArray s ix elt -> ix -> ST s elt 
31
32     readCharArray,      -- :: Ix ix => MutableByteArray s ix -> ix -> ST s Char 
33     readIntArray,       -- :: Ix ix => MutableByteArray s ix -> ix -> ST s Int
34     readAddrArray,      -- :: Ix ix => MutableByteArray s ix -> ix -> ST s Addr
35     readFloatArray,     -- :: Ix ix => MutableByteArray s ix -> ix -> ST s Float
36     readDoubleArray,    -- :: Ix ix => MutableByteArray s ix -> ix -> ST s Double
37
38     writeArray,         -- :: Ix ix => MutableArray s ix elt -> ix -> elt -> ST s () 
39     writeCharArray,     -- :: Ix ix => MutableByteArray s ix -> ix -> Char -> ST s () 
40     writeIntArray,      -- :: Ix ix => MutableByteArray s ix -> ix -> Int  -> ST s () 
41     writeAddrArray,     -- :: Ix ix => MutableByteArray s ix -> ix -> Addr -> ST s () 
42     writeFloatArray,    -- :: Ix ix => MutableByteArray s ix -> ix -> Float -> ST s () 
43     writeDoubleArray,   -- :: Ix ix => MutableByteArray s ix -> ix -> Double -> ST s () 
44
45     freezeArray,        -- :: Ix ix => MutableArray s ix elt -> ST s (Array ix elt)
46     freezeCharArray,    -- :: Ix ix => MutableByteArray s ix -> ST s (ByteArray ix)
47     freezeIntArray,     -- :: Ix ix => MutableByteArray s ix -> ST s (ByteArray ix)
48     freezeAddrArray,    -- :: Ix ix => MutableByteArray s ix -> ST s (ByteArray ix)
49     freezeFloatArray,   -- :: Ix ix => MutableByteArray s ix -> ST s (ByteArray ix)
50     freezeDoubleArray,  -- :: Ix ix => MutableByteArray s ix -> ST s (ByteArray ix)
51
52     unsafeFreezeArray,     -- :: Ix ix => MutableArray s ix elt -> ST s (Array ix elt)  
53     unsafeFreezeByteArray, -- :: Ix ix => MutableByteArray s ix -> ST s (ByteArray ix)
54     thawArray              -- :: Ix ix => Array ix elt -> ST s (MutableArray s ix elt)
55
56     ) where
57
58 import ArrBase
59 import ST
60 import Ix
61
62 \end{code}