[project @ 2002-09-20 13:15:07 by ross]
[packages/random.git] / Data / Array / IArray.hs
1 -----------------------------------------------------------------------------
2 -- |
3 -- Module : Data.Array.IArray
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 -- Immutable arrays, with an overloaded interface. For array types
12 -- which can be used with this interface, see "Data.Array",
13 -- "Data.Array.Unboxed", and "Data.Array.Diff".
14 --
15 -----------------------------------------------------------------------------
16
17 module Data.Array.IArray (
18 -- * Class of immutable array types
19 IArray, -- :: (* -> * -> *) -> * -> class
20
21 -- * Class of array types with immutable bounds
22 HasBounds, -- :: (* -> * -> *) -> class
23
24 -- * Ordinary boxed\/lazy arrays
25 Array,
26
27 -- * The @Ix@ class and operations
28 module Data.Ix,
29
30 -- * Array construction
31 array, -- :: (IArray a e, Ix i) => (i,i) -> [(i, e)] -> a i e
32 listArray, -- :: (IArray a e, Ix i) => (i,i) -> [e] -> a i e
33 accumArray, -- :: (IArray a e, Ix i) => (e -> e' -> e) -> e -> (i,i) -> [(i, e')] -> a i e
34
35 -- * Indexing arrays
36 (!), -- :: (IArray a e, Ix i) => a i e -> i -> e
37
38 -- * Incremental updates
39 (//), -- :: (IArray a e, Ix i) => a i e -> [(i, e)] -> a i e
40 accum, -- :: (IArray a e, Ix i) => (e -> e' -> e) -> a i e -> [(i, e')] -> a i e
41
42 -- * Derived Arrays
43 amap, -- :: (IArray a e', IArray a e, Ix i) => (e' -> e) -> a i e' -> a i e
44 ixmap, -- :: (IArray a e, Ix i, Ix j) => (i,i) -> (i -> j) -> a j e -> a i e
45
46 -- * Deconstructing arrays
47 bounds, -- :: (HasBounds a, Ix i) => a i e -> (i,i)
48 indices, -- :: (HasBounds a, Ix i) => a i e -> [i]
49 elems, -- :: (IArray a e, Ix i) => a i e -> [e]
50 assocs, -- :: (IArray a e, Ix i) => a i e -> [(i, e)]
51 ) where
52
53 import Prelude
54
55 import Data.Ix
56 import Data.Array (Array)
57 import Data.Array.Base