Spec-Zone.ru › Haskell 7

Data.Array.IO

Copyright (c) The University of Glasgow 2001
License BSD-style (see the file libraries/base/LICENSE)
Maintainer libraries@haskell.org
Stability experimental
Portability non-portable (uses Data.Array.MArray)
Safe Haskell None
Language Haskell2010

Contents

  • IO arrays with boxed elements
  • IO arrays with unboxed elements
  • Overloaded mutable array interface
  • Doing I/O with IOUArrays

Description

Mutable boxed and unboxed arrays in the IO monad.

IO arrays with boxed elements

data IOArray i e :: * -> * -> * Source

An IOArray is a mutable, boxed, non-strict array 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.

Instances

MArray IOArray e IO
Eq (IOArray i e)

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

MArray IOUArray Bool IO
MArray IOUArray Char IO
MArray IOUArray Double IO
MArray IOUArray Float IO
MArray IOUArray Int IO
MArray IOUArray Int8 IO
MArray IOUArray Int16 IO
MArray IOUArray Int32 IO
MArray IOUArray Int64 IO
MArray IOUArray Word IO
MArray IOUArray Word8 IO
MArray IOUArray Word16 IO
MArray IOUArray Word32 IO
MArray IOUArray Word64 IO
MArray IOUArray (StablePtr a) IO
MArray IOUArray (Ptr a) IO
MArray IOUArray (FunPtr a) IO
Eq (IOUArray i e)

Overloaded mutable array interface

module Data.Array.MArray

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.

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

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API