Data.Array.Unboxed

Copyright (c) The University of Glasgow 2001
License BSD-style (see the file libraries/base/LICENSE)
Maintainer [email protected]
Stability experimental
Portability non-portable (uses Data.Array.IArray)
Safe Haskell Trustworthy
Language Haskell2010

Description

Unboxed immutable arrays.

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 Bool
Instance details

Defined in Data.Array.Base

Methods

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

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

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

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

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

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

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

IArray UArray Char
Instance details

Defined in Data.Array.Base

Methods

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

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

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

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

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

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

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

IArray UArray Double
Instance details

Defined in Data.Array.Base

Methods

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

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

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

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

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

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

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

IArray UArray Float
Instance details

Defined in Data.Array.Base

Methods

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

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

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

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

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

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

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

IArray UArray Int
Instance details

Defined in Data.Array.Base

Methods

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

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

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

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

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

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

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

IArray UArray Int8
Instance details

Defined in Data.Array.Base

Methods

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

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

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

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

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

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

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

IArray UArray Int16
Instance details

Defined in Data.Array.Base

Methods

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

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

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

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

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

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

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

IArray UArray Int32
Instance details

Defined in Data.Array.Base

Methods

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

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

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

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

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

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

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

IArray UArray Int64
Instance details

Defined in Data.Array.Base

Methods

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

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

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

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

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

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

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

IArray UArray Word
Instance details

Defined in Data.Array.Base

Methods

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

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

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

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

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

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

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

IArray UArray Word8
Instance details

Defined in Data.Array.Base

Methods

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

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

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

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

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

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

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

IArray UArray Word16
Instance details

Defined in Data.Array.Base

Methods

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

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

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

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

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

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

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

IArray UArray Word32
Instance details

Defined in Data.Array.Base

Methods

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

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

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

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

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

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

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

IArray UArray Word64
Instance details

Defined in Data.Array.Base

Methods

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

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

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

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

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

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

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

IArray UArray (StablePtr a)
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

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

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

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

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

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

IArray UArray (Ptr a)
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

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

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

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

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

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

IArray UArray (FunPtr a)
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

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

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

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

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

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

(Ix ix, Eq e, IArray UArray e) => Eq (UArray ix e)
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)
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

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

Defined in Data.Array.Base

(Ix ix, Show ix, Show e, IArray UArray e) => Show (UArray ix e)
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

The overloaded immutable array interface

module Data.Array.IArray

© The University of Glasgow and others
Licensed under a BSD-style license (see top of the page).
https://downloads.haskell.org/~ghc/8.10.2/docs/html/libraries/array-0.5.4.0/Data-Array-Unboxed.html