array-0.5.6.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.MArray)
Safe HaskellSafe
LanguageHaskell2010

Data.Array.IO.Safe

Description

Mutable boxed and unboxed arrays in the IO monad. . Safe API only of Data.Array.IO.

Since: array-0.4.0.0

Synopsis

IO arrays with boxed elements

data IOArray i e #

Instances

Instances details
MArray IOArray e IO Source # 
Instance details

Defined in Data.Array.Base

Methods

getBounds :: Ix i => IOArray i e -> IO (i, i) Source #

getNumElements :: Ix i => IOArray i e -> IO Int Source #

newArray :: Ix i => (i, i) -> e -> IO (IOArray i e) Source #

newArray_ :: Ix i => (i, i) -> IO (IOArray i e) Source #

unsafeNewArray_ :: Ix i => (i, i) -> IO (IOArray i e) Source #

unsafeRead :: Ix i => IOArray i e -> Int -> IO e Source #

unsafeWrite :: Ix i => IOArray i e -> Int -> e -> IO () Source #

Eq (IOArray i e) 
Instance details

Defined in GHC.Internal.IOArray

Methods

(==) :: IOArray i e -> IOArray i e -> Bool #

(/=) :: IOArray i e -> IOArray i e -> Bool #

IO arrays with unboxed elements

data IOUArray i e Source #

Mutable, unboxed, strict arrays in the IO monad. The type arguments are as follows:

  • i: the index type of the array (should be an instance of Ix)
  • e: the element type of the array. Only certain element types are supported: see Data.Array.MArray for a list of instances.

Instances

Instances details
MArray IOUArray Int16 IO Source # 
Instance details

Defined in Data.Array.IO.Internals

Methods

getBounds :: Ix i => IOUArray i Int16 -> IO (i, i) Source #

getNumElements :: Ix i => IOUArray i Int16 -> IO Int Source #

newArray :: Ix i => (i, i) -> Int16 -> IO (IOUArray i Int16) Source #

newArray_ :: Ix i => (i, i) -> IO (IOUArray i Int16) Source #

unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i Int16) Source #

unsafeRead :: Ix i => IOUArray i Int16 -> Int -> IO Int16 Source #

unsafeWrite :: Ix i => IOUArray i Int16 -> Int -> Int16 -> IO () Source #

MArray IOUArray Int32 IO Source # 
Instance details

Defined in Data.Array.IO.Internals

Methods

getBounds :: Ix i => IOUArray i Int32 -> IO (i, i) Source #

getNumElements :: Ix i => IOUArray i Int32 -> IO Int Source #

newArray :: Ix i => (i, i) -> Int32 -> IO (IOUArray i Int32) Source #

newArray_ :: Ix i => (i, i) -> IO (IOUArray i Int32) Source #

unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i Int32) Source #

unsafeRead :: Ix i => IOUArray i Int32 -> Int -> IO Int32 Source #

unsafeWrite :: Ix i => IOUArray i Int32 -> Int -> Int32 -> IO () Source #

MArray IOUArray Int64 IO Source # 
Instance details

Defined in Data.Array.IO.Internals

Methods

getBounds :: Ix i => IOUArray i Int64 -> IO (i, i) Source #

getNumElements :: Ix i => IOUArray i Int64 -> IO Int Source #

newArray :: Ix i => (i, i) -> Int64 -> IO (IOUArray i Int64) Source #

newArray_ :: Ix i => (i, i) -> IO (IOUArray i Int64) Source #

unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i Int64) Source #

unsafeRead :: Ix i => IOUArray i Int64 -> Int -> IO Int64 Source #

unsafeWrite :: Ix i => IOUArray i Int64 -> Int -> Int64 -> IO () Source #

MArray IOUArray Int8 IO Source # 
Instance details

Defined in Data.Array.IO.Internals

Methods

getBounds :: Ix i => IOUArray i Int8 -> IO (i, i) Source #

getNumElements :: Ix i => IOUArray i Int8 -> IO Int Source #

newArray :: Ix i => (i, i) -> Int8 -> IO (IOUArray i Int8) Source #

newArray_ :: Ix i => (i, i) -> IO (IOUArray i Int8) Source #

unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i Int8) Source #

unsafeRead :: Ix i => IOUArray i Int8 -> Int -> IO Int8 Source #

unsafeWrite :: Ix i => IOUArray i Int8 -> Int -> Int8 -> IO () Source #

MArray IOUArray Word16 IO Source # 
Instance details

Defined in Data.Array.IO.Internals

Methods

getBounds :: Ix i => IOUArray i Word16 -> IO (i, i) Source #

getNumElements :: Ix i => IOUArray i Word16 -> IO Int Source #

newArray :: Ix i => (i, i) -> Word16 -> IO (IOUArray i Word16) Source #

newArray_ :: Ix i => (i, i) -> IO (IOUArray i Word16) Source #

unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i Word16) Source #

unsafeRead :: Ix i => IOUArray i Word16 -> Int -> IO Word16 Source #

unsafeWrite :: Ix i => IOUArray i Word16 -> Int -> Word16 -> IO () Source #

MArray IOUArray Word32 IO Source # 
Instance details

Defined in Data.Array.IO.Internals

Methods

getBounds :: Ix i => IOUArray i Word32 -> IO (i, i) Source #

getNumElements :: Ix i => IOUArray i Word32 -> IO Int Source #

newArray :: Ix i => (i, i) -> Word32 -> IO (IOUArray i Word32) Source #

newArray_ :: Ix i => (i, i) -> IO (IOUArray i Word32) Source #

unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i Word32) Source #

unsafeRead :: Ix i => IOUArray i Word32 -> Int -> IO Word32 Source #

unsafeWrite :: Ix i => IOUArray i Word32 -> Int -> Word32 -> IO () Source #

MArray IOUArray Word64 IO Source # 
Instance details

Defined in Data.Array.IO.Internals

Methods

getBounds :: Ix i => IOUArray i Word64 -> IO (i, i) Source #

getNumElements :: Ix i => IOUArray i Word64 -> IO Int Source #

newArray :: Ix i => (i, i) -> Word64 -> IO (IOUArray i Word64) Source #

newArray_ :: Ix i => (i, i) -> IO (IOUArray i Word64) Source #

unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i Word64) Source #

unsafeRead :: Ix i => IOUArray i Word64 -> Int -> IO Word64 Source #

unsafeWrite :: Ix i => IOUArray i Word64 -> Int -> Word64 -> IO () Source #

MArray IOUArray Word8 IO Source # 
Instance details

Defined in Data.Array.IO.Internals

Methods

getBounds :: Ix i => IOUArray i Word8 -> IO (i, i) Source #

getNumElements :: Ix i => IOUArray i Word8 -> IO Int Source #

newArray :: Ix i => (i, i) -> Word8 -> IO (IOUArray i Word8) Source #

newArray_ :: Ix i => (i, i) -> IO (IOUArray i Word8) Source #

unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i Word8) Source #

unsafeRead :: Ix i => IOUArray i Word8 -> Int -> IO Word8 Source #

unsafeWrite :: Ix i => IOUArray i Word8 -> Int -> Word8 -> IO () Source #

MArray IOUArray Bool IO Source # 
Instance details

Defined in Data.Array.IO.Internals

Methods

getBounds :: Ix i => IOUArray i Bool -> IO (i, i) Source #

getNumElements :: Ix i => IOUArray i Bool -> IO Int Source #

newArray :: Ix i => (i, i) -> Bool -> IO (IOUArray i Bool) Source #

newArray_ :: Ix i => (i, i) -> IO (IOUArray i Bool) Source #

unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i Bool) Source #

unsafeRead :: Ix i => IOUArray i Bool -> Int -> IO Bool Source #

unsafeWrite :: Ix i => IOUArray i Bool -> Int -> Bool -> IO () Source #

MArray IOUArray Char IO Source # 
Instance details

Defined in Data.Array.IO.Internals

Methods

getBounds :: Ix i => IOUArray i Char -> IO (i, i) Source #

getNumElements :: Ix i => IOUArray i Char -> IO Int Source #

newArray :: Ix i => (i, i) -> Char -> IO (IOUArray i Char) Source #

newArray_ :: Ix i => (i, i) -> IO (IOUArray i Char) Source #

unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i Char) Source #

unsafeRead :: Ix i => IOUArray i Char -> Int -> IO Char Source #

unsafeWrite :: Ix i => IOUArray i Char -> Int -> Char -> IO () Source #

MArray IOUArray Double IO Source # 
Instance details

Defined in Data.Array.IO.Internals

Methods

getBounds :: Ix i => IOUArray i Double -> IO (i, i) Source #

getNumElements :: Ix i => IOUArray i Double -> IO Int Source #

newArray :: Ix i => (i, i) -> Double -> IO (IOUArray i Double) Source #

newArray_ :: Ix i => (i, i) -> IO (IOUArray i Double) Source #

unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i Double) Source #

unsafeRead :: Ix i => IOUArray i Double -> Int -> IO Double Source #

unsafeWrite :: Ix i => IOUArray i Double -> Int -> Double -> IO () Source #

MArray IOUArray Float IO Source # 
Instance details

Defined in Data.Array.IO.Internals

Methods

getBounds :: Ix i => IOUArray i Float -> IO (i, i) Source #

getNumElements :: Ix i => IOUArray i Float -> IO Int Source #

newArray :: Ix i => (i, i) -> Float -> IO (IOUArray i Float) Source #

newArray_ :: Ix i => (i, i) -> IO (IOUArray i Float) Source #

unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i Float) Source #

unsafeRead :: Ix i => IOUArray i Float -> Int -> IO Float Source #

unsafeWrite :: Ix i => IOUArray i Float -> Int -> Float -> IO () Source #

MArray IOUArray Int IO Source # 
Instance details

Defined in Data.Array.IO.Internals

Methods

getBounds :: Ix i => IOUArray i Int -> IO (i, i) Source #

getNumElements :: Ix i => IOUArray i Int -> IO Int Source #

newArray :: Ix i => (i, i) -> Int -> IO (IOUArray i Int) Source #

newArray_ :: Ix i => (i, i) -> IO (IOUArray i Int) Source #

unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i Int) Source #

unsafeRead :: Ix i => IOUArray i Int -> Int -> IO Int Source #

unsafeWrite :: Ix i => IOUArray i Int -> Int -> Int -> IO () Source #

MArray IOUArray Word IO Source # 
Instance details

Defined in Data.Array.IO.Internals

Methods

getBounds :: Ix i => IOUArray i Word -> IO (i, i) Source #

getNumElements :: Ix i => IOUArray i Word -> IO Int Source #

newArray :: Ix i => (i, i) -> Word -> IO (IOUArray i Word) Source #

newArray_ :: Ix i => (i, i) -> IO (IOUArray i Word) Source #

unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i Word) Source #

unsafeRead :: Ix i => IOUArray i Word -> Int -> IO Word Source #

unsafeWrite :: Ix i => IOUArray i Word -> Int -> Word -> IO () Source #

MArray IOUArray (FunPtr a) IO Source # 
Instance details

Defined in Data.Array.IO.Internals

Methods

getBounds :: Ix i => IOUArray i (FunPtr a) -> IO (i, i) Source #

getNumElements :: Ix i => IOUArray i (FunPtr a) -> IO Int Source #

newArray :: Ix i => (i, i) -> FunPtr a -> IO (IOUArray i (FunPtr a)) Source #

newArray_ :: Ix i => (i, i) -> IO (IOUArray i (FunPtr a)) Source #

unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i (FunPtr a)) Source #

unsafeRead :: Ix i => IOUArray i (FunPtr a) -> Int -> IO (FunPtr a) Source #

unsafeWrite :: Ix i => IOUArray i (FunPtr a) -> Int -> FunPtr a -> IO () Source #

MArray IOUArray (Ptr a) IO Source # 
Instance details

Defined in Data.Array.IO.Internals

Methods

getBounds :: Ix i => IOUArray i (Ptr a) -> IO (i, i) Source #

getNumElements :: Ix i => IOUArray i (Ptr a) -> IO Int Source #

newArray :: Ix i => (i, i) -> Ptr a -> IO (IOUArray i (Ptr a)) Source #

newArray_ :: Ix i => (i, i) -> IO (IOUArray i (Ptr a)) Source #

unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i (Ptr a)) Source #

unsafeRead :: Ix i => IOUArray i (Ptr a) -> Int -> IO (Ptr a) Source #

unsafeWrite :: Ix i => IOUArray i (Ptr a) -> Int -> Ptr a -> IO () Source #

MArray IOUArray (StablePtr a) IO Source # 
Instance details

Defined in Data.Array.IO.Internals

Methods

getBounds :: Ix i => IOUArray i (StablePtr a) -> IO (i, i) Source #

getNumElements :: Ix i => IOUArray i (StablePtr a) -> IO Int Source #

newArray :: Ix i => (i, i) -> StablePtr a -> IO (IOUArray i (StablePtr a)) Source #

newArray_ :: Ix i => (i, i) -> IO (IOUArray i (StablePtr a)) Source #

unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i (StablePtr a)) Source #

unsafeRead :: Ix i => IOUArray i (StablePtr a) -> Int -> IO (StablePtr a) Source #

unsafeWrite :: Ix i => IOUArray i (StablePtr a) -> Int -> StablePtr a -> IO () Source #

Eq (IOUArray i e) Source # 
Instance details

Defined in Data.Array.IO.Internals

Methods

(==) :: IOUArray i e -> IOUArray i e -> Bool #

(/=) :: IOUArray i e -> IOUArray i e -> Bool #

Overloaded mutable array interface

Doing I/O with IOUArrays

hGetArray Source #

Arguments

:: Handle

Handle to read from

-> IOUArray Int Word8

Array in which to place the values

-> Int

Number of Word8s to read

-> IO Int

Returns: the number of Word8s actually read, which might be smaller than the number requested if the end of file was reached.

Reads a number of Word8s from the specified Handle directly into an array.

hPutArray Source #

Arguments

:: Handle

Handle to write to

-> IOUArray Int Word8

Array to write from

-> Int

Number of Word8s to write

-> IO () 

Writes an array of Word8 to the specified Handle.