array-0.5.8.0: Mutable and immutable arrays
Copyright(c) The University of Glasgow 2001
LicenseBSD-style (see the file libraries/base/LICENSE)
Maintainerlibraries@haskell.org
Stabilityexperimental
Portabilitynon-portable (uses Data.Array.IArray)
Safe HaskellTrustworthy
LanguageHaskell2010

Data.Array.Unboxed

Description

Unboxed immutable arrays.

Synopsis

Arrays with unboxed elements

data UArray i e Source #

Arrays with unboxed elements. Instances of IArray are provided for UArray with certain element types (Int, Float, Char, etc.; see the UArray class for a full list).

A UArray will generally be more efficient (in terms of both time and space) than the equivalent Array with the same element type. However, UArray is strict in its elements - so don't use UArray if you require the non-strictness that Array provides.

Because the IArray interface provides operations overloaded on the type of the array, it should be possible to just change the array type being used by a program from say Array to UArray to get the benefits of unboxed arrays (don't forget to import Data.Array.Unboxed instead of Data.Array).

Instances

Instances details
IArray UArray Int16 Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Int16 -> (i, i) Source #

numElements :: Ix i => UArray i Int16 -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Int16)] -> UArray i Int16 Source #

unsafeAt :: Ix i => UArray i Int16 -> Int -> Int16 Source #

unsafeReplace :: Ix i => UArray i Int16 -> [(Int, Int16)] -> UArray i Int16 Source #

unsafeAccum :: Ix i => (Int16 -> e' -> Int16) -> UArray i Int16 -> [(Int, e')] -> UArray i Int16 Source #

unsafeAccumArray :: Ix i => (Int16 -> e' -> Int16) -> Int16 -> (i, i) -> [(Int, e')] -> UArray i Int16 Source #

IArray UArray Int32 Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Int32 -> (i, i) Source #

numElements :: Ix i => UArray i Int32 -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Int32)] -> UArray i Int32 Source #

unsafeAt :: Ix i => UArray i Int32 -> Int -> Int32 Source #

unsafeReplace :: Ix i => UArray i Int32 -> [(Int, Int32)] -> UArray i Int32 Source #

unsafeAccum :: Ix i => (Int32 -> e' -> Int32) -> UArray i Int32 -> [(Int, e')] -> UArray i Int32 Source #

unsafeAccumArray :: Ix i => (Int32 -> e' -> Int32) -> Int32 -> (i, i) -> [(Int, e')] -> UArray i Int32 Source #

IArray UArray Int64 Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Int64 -> (i, i) Source #

numElements :: Ix i => UArray i Int64 -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Int64)] -> UArray i Int64 Source #

unsafeAt :: Ix i => UArray i Int64 -> Int -> Int64 Source #

unsafeReplace :: Ix i => UArray i Int64 -> [(Int, Int64)] -> UArray i Int64 Source #

unsafeAccum :: Ix i => (Int64 -> e' -> Int64) -> UArray i Int64 -> [(Int, e')] -> UArray i Int64 Source #

unsafeAccumArray :: Ix i => (Int64 -> e' -> Int64) -> Int64 -> (i, i) -> [(Int, e')] -> UArray i Int64 Source #

IArray UArray Int8 Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Int8 -> (i, i) Source #

numElements :: Ix i => UArray i Int8 -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Int8)] -> UArray i Int8 Source #

unsafeAt :: Ix i => UArray i Int8 -> Int -> Int8 Source #

unsafeReplace :: Ix i => UArray i Int8 -> [(Int, Int8)] -> UArray i Int8 Source #

unsafeAccum :: Ix i => (Int8 -> e' -> Int8) -> UArray i Int8 -> [(Int, e')] -> UArray i Int8 Source #

unsafeAccumArray :: Ix i => (Int8 -> e' -> Int8) -> Int8 -> (i, i) -> [(Int, e')] -> UArray i Int8 Source #

IArray UArray Word16 Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Word16 -> (i, i) Source #

numElements :: Ix i => UArray i Word16 -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Word16)] -> UArray i Word16 Source #

unsafeAt :: Ix i => UArray i Word16 -> Int -> Word16 Source #

unsafeReplace :: Ix i => UArray i Word16 -> [(Int, Word16)] -> UArray i Word16 Source #

unsafeAccum :: Ix i => (Word16 -> e' -> Word16) -> UArray i Word16 -> [(Int, e')] -> UArray i Word16 Source #

unsafeAccumArray :: Ix i => (Word16 -> e' -> Word16) -> Word16 -> (i, i) -> [(Int, e')] -> UArray i Word16 Source #

IArray UArray Word32 Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Word32 -> (i, i) Source #

numElements :: Ix i => UArray i Word32 -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Word32)] -> UArray i Word32 Source #

unsafeAt :: Ix i => UArray i Word32 -> Int -> Word32 Source #

unsafeReplace :: Ix i => UArray i Word32 -> [(Int, Word32)] -> UArray i Word32 Source #

unsafeAccum :: Ix i => (Word32 -> e' -> Word32) -> UArray i Word32 -> [(Int, e')] -> UArray i Word32 Source #

unsafeAccumArray :: Ix i => (Word32 -> e' -> Word32) -> Word32 -> (i, i) -> [(Int, e')] -> UArray i Word32 Source #

IArray UArray Word64 Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Word64 -> (i, i) Source #

numElements :: Ix i => UArray i Word64 -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Word64)] -> UArray i Word64 Source #

unsafeAt :: Ix i => UArray i Word64 -> Int -> Word64 Source #

unsafeReplace :: Ix i => UArray i Word64 -> [(Int, Word64)] -> UArray i Word64 Source #

unsafeAccum :: Ix i => (Word64 -> e' -> Word64) -> UArray i Word64 -> [(Int, e')] -> UArray i Word64 Source #

unsafeAccumArray :: Ix i => (Word64 -> e' -> Word64) -> Word64 -> (i, i) -> [(Int, e')] -> UArray i Word64 Source #

IArray UArray Word8 Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Word8 -> (i, i) Source #

numElements :: Ix i => UArray i Word8 -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Word8)] -> UArray i Word8 Source #

unsafeAt :: Ix i => UArray i Word8 -> Int -> Word8 Source #

unsafeReplace :: Ix i => UArray i Word8 -> [(Int, Word8)] -> UArray i Word8 Source #

unsafeAccum :: Ix i => (Word8 -> e' -> Word8) -> UArray i Word8 -> [(Int, e')] -> UArray i Word8 Source #

unsafeAccumArray :: Ix i => (Word8 -> e' -> Word8) -> Word8 -> (i, i) -> [(Int, e')] -> UArray i Word8 Source #

IArray UArray Bool Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Bool -> (i, i) Source #

numElements :: Ix i => UArray i Bool -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Bool)] -> UArray i Bool Source #

unsafeAt :: Ix i => UArray i Bool -> Int -> Bool Source #

unsafeReplace :: Ix i => UArray i Bool -> [(Int, Bool)] -> UArray i Bool Source #

unsafeAccum :: Ix i => (Bool -> e' -> Bool) -> UArray i Bool -> [(Int, e')] -> UArray i Bool Source #

unsafeAccumArray :: Ix i => (Bool -> e' -> Bool) -> Bool -> (i, i) -> [(Int, e')] -> UArray i Bool Source #

IArray UArray Char Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Char -> (i, i) Source #

numElements :: Ix i => UArray i Char -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Char)] -> UArray i Char Source #

unsafeAt :: Ix i => UArray i Char -> Int -> Char Source #

unsafeReplace :: Ix i => UArray i Char -> [(Int, Char)] -> UArray i Char Source #

unsafeAccum :: Ix i => (Char -> e' -> Char) -> UArray i Char -> [(Int, e')] -> UArray i Char Source #

unsafeAccumArray :: Ix i => (Char -> e' -> Char) -> Char -> (i, i) -> [(Int, e')] -> UArray i Char Source #

IArray UArray Double Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Double -> (i, i) Source #

numElements :: Ix i => UArray i Double -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Double)] -> UArray i Double Source #

unsafeAt :: Ix i => UArray i Double -> Int -> Double Source #

unsafeReplace :: Ix i => UArray i Double -> [(Int, Double)] -> UArray i Double Source #

unsafeAccum :: Ix i => (Double -> e' -> Double) -> UArray i Double -> [(Int, e')] -> UArray i Double Source #

unsafeAccumArray :: Ix i => (Double -> e' -> Double) -> Double -> (i, i) -> [(Int, e')] -> UArray i Double Source #

IArray UArray Float Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Float -> (i, i) Source #

numElements :: Ix i => UArray i Float -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Float)] -> UArray i Float Source #

unsafeAt :: Ix i => UArray i Float -> Int -> Float Source #

unsafeReplace :: Ix i => UArray i Float -> [(Int, Float)] -> UArray i Float Source #

unsafeAccum :: Ix i => (Float -> e' -> Float) -> UArray i Float -> [(Int, e')] -> UArray i Float Source #

unsafeAccumArray :: Ix i => (Float -> e' -> Float) -> Float -> (i, i) -> [(Int, e')] -> UArray i Float Source #

IArray UArray Int Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Int -> (i, i) Source #

numElements :: Ix i => UArray i Int -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Int)] -> UArray i Int Source #

unsafeAt :: Ix i => UArray i Int -> Int -> Int Source #

unsafeReplace :: Ix i => UArray i Int -> [(Int, Int)] -> UArray i Int Source #

unsafeAccum :: Ix i => (Int -> e' -> Int) -> UArray i Int -> [(Int, e')] -> UArray i Int Source #

unsafeAccumArray :: Ix i => (Int -> e' -> Int) -> Int -> (i, i) -> [(Int, e')] -> UArray i Int Source #

IArray UArray Word Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Word -> (i, i) Source #

numElements :: Ix i => UArray i Word -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Word)] -> UArray i Word Source #

unsafeAt :: Ix i => UArray i Word -> Int -> Word Source #

unsafeReplace :: Ix i => UArray i Word -> [(Int, Word)] -> UArray i Word Source #

unsafeAccum :: Ix i => (Word -> e' -> Word) -> UArray i Word -> [(Int, e')] -> UArray i Word Source #

unsafeAccumArray :: Ix i => (Word -> e' -> Word) -> Word -> (i, i) -> [(Int, e')] -> UArray i Word Source #

IArray UArray (FunPtr a) Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i (FunPtr a) -> (i, i) Source #

numElements :: Ix i => UArray i (FunPtr a) -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, FunPtr a)] -> UArray i (FunPtr a) Source #

unsafeAt :: Ix i => UArray i (FunPtr a) -> Int -> FunPtr a Source #

unsafeReplace :: Ix i => UArray i (FunPtr a) -> [(Int, FunPtr a)] -> UArray i (FunPtr a) Source #

unsafeAccum :: Ix i => (FunPtr a -> e' -> FunPtr a) -> UArray i (FunPtr a) -> [(Int, e')] -> UArray i (FunPtr a) Source #

unsafeAccumArray :: Ix i => (FunPtr a -> e' -> FunPtr a) -> FunPtr a -> (i, i) -> [(Int, e')] -> UArray i (FunPtr a) Source #

IArray UArray (Ptr a) Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i (Ptr a) -> (i, i) Source #

numElements :: Ix i => UArray i (Ptr a) -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Ptr a)] -> UArray i (Ptr a) Source #

unsafeAt :: Ix i => UArray i (Ptr a) -> Int -> Ptr a Source #

unsafeReplace :: Ix i => UArray i (Ptr a) -> [(Int, Ptr a)] -> UArray i (Ptr a) Source #

unsafeAccum :: Ix i => (Ptr a -> e' -> Ptr a) -> UArray i (Ptr a) -> [(Int, e')] -> UArray i (Ptr a) Source #

unsafeAccumArray :: Ix i => (Ptr a -> e' -> Ptr a) -> Ptr a -> (i, i) -> [(Int, e')] -> UArray i (Ptr a) Source #

IArray UArray (StablePtr a) Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i (StablePtr a) -> (i, i) Source #

numElements :: Ix i => UArray i (StablePtr a) -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, StablePtr a)] -> UArray i (StablePtr a) Source #

unsafeAt :: Ix i => UArray i (StablePtr a) -> Int -> StablePtr a Source #

unsafeReplace :: Ix i => UArray i (StablePtr a) -> [(Int, StablePtr a)] -> UArray i (StablePtr a) Source #

unsafeAccum :: Ix i => (StablePtr a -> e' -> StablePtr a) -> UArray i (StablePtr a) -> [(Int, e')] -> UArray i (StablePtr a) Source #

unsafeAccumArray :: Ix i => (StablePtr a -> e' -> StablePtr a) -> StablePtr a -> (i, i) -> [(Int, e')] -> UArray i (StablePtr a) Source #

(Ix ix, Read ix, Read e, IArray UArray e) => Read (UArray ix e) Source # 
Instance details

Defined in Data.Array.Base

(Ix ix, Show ix, Show e, IArray UArray e) => Show (UArray ix e) Source # 
Instance details

Defined in Data.Array.Base

Methods

showsPrec :: Int -> UArray ix e -> ShowS Source #

show :: UArray ix e -> String Source #

showList :: [UArray ix e] -> ShowS Source #

(Ix ix, Eq e, IArray UArray e) => Eq (UArray ix e) Source # 
Instance details

Defined in Data.Array.Base

Methods

(==) :: UArray ix e -> UArray ix e -> Bool #

(/=) :: UArray ix e -> UArray ix e -> Bool #

(Ix ix, Ord e, IArray UArray e) => Ord (UArray ix e) Source # 
Instance details

Defined in Data.Array.Base

Methods

compare :: UArray ix e -> UArray ix e -> Ordering #

(<) :: UArray ix e -> UArray ix e -> Bool #

(<=) :: UArray ix e -> UArray ix e -> Bool #

(>) :: UArray ix e -> UArray ix e -> Bool #

(>=) :: UArray ix e -> UArray ix e -> Bool #

max :: UArray ix e -> UArray ix e -> UArray ix e #

min :: UArray ix e -> UArray ix e -> UArray ix e #

The overloaded immutable array interface