[project @ 2005-10-13 11:09:50 by ross]
[packages/containers.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 (uses Data.Array.Base)
10 --
11 -- Immutable arrays, with an overloaded interface. For array types which
12 -- can be used with this interface, see the 'Array' type exported by this
13 -- module, and the "Data.Array.Unboxed" and "Data.Array.Diff" modules.
14 --
15 -----------------------------------------------------------------------------
16
17 module Data.Array.IArray (
18 -- * Array classes
19 HasBounds, -- :: (* -> * -> *) -> class
20 IArray, -- :: (* -> * -> *) -> * -> class
21
22 module Data.Ix,
23
24 -- * Immutable non-strict (boxed) arrays
25 Array,
26
27 -- * Array construction
28 array, -- :: (IArray a e, Ix i) => (i,i) -> [(i, e)] -> a i e
29 listArray, -- :: (IArray a e, Ix i) => (i,i) -> [e] -> a i e
30 accumArray, -- :: (IArray a e, Ix i) => (e -> e' -> e) -> e -> (i,i) -> [(i, e')] -> a i e
31
32 -- * Accessing arrays
33 (!), -- :: (IArray a e, Ix i) => a i e -> i -> e
34 bounds, -- :: (HasBounds a, Ix i) => a i e -> (i,i)
35 indices, -- :: (HasBounds a, Ix i) => a i e -> [i]
36 elems, -- :: (IArray a e, Ix i) => a i e -> [e]
37 assocs, -- :: (IArray a e, Ix i) => a i e -> [(i, e)]
38
39 -- * Incremental array updates
40 (//), -- :: (IArray a e, Ix i) => a i e -> [(i, e)] -> a i e
41 accum, -- :: (IArray a e, Ix i) => (e -> e' -> e) -> a i e -> [(i, e')] -> a i e
42
43 -- * Derived arrays
44 amap, -- :: (IArray a e', IArray a e, Ix i) => (e' -> e) -> a i e' -> a i e
45 ixmap, -- :: (IArray a e, Ix i, Ix j) => (i,i) -> (i -> j) -> a j e -> a i e
46 ) where
47
48 import Prelude
49
50 import Data.Ix
51 import Data.Array (Array)
52 import Data.Array.Base