Community
Modules 50

Data.Text.Array

License : BSD-style Maintainer : bos@serpentine.com Portability : portable

Packed, unboxed, heap-resident arrays. Suitable for performance critical use, both in terms of large data quantities and high speed.

This module is intended to be imported qualified, to avoid name clashes with Prelude functions, e.g.

import qualified Data.Text.Array as A

The names in this module resemble those in the Array family of modules, but are shorter due to the assumption of qualified naming.

Types

type Array = ByteArray

Immutable array type.

type MArray = MutableByteArray

Mutable array type, for use in the ST monad.

Functions

resizeM :: MArray s -> Int -> ST s (MArray s)

shrinkM :: MArray s -> Int -> ST s ()

copyM :: MArray s -> Int -> MArray s -> Int -> Int -> ST s ()

Copy some elements of a mutable array.

Destination

Source

Int

Destination offset

Int

Source offset

Int

Count

copyI :: Int -> MArray s -> Int -> Array -> Int -> ST s ()

Copy some elements of an immutable array.

Destination

Int

Count

Int

Destination offset

Array

Source

Int

Source offset

copyFromPointer :: MArray s -> Int -> Ptr Word8 -> Int -> ST s ()

Copy from pointer.

Destination

Source

Int

Destination offset

Int

Count

copyToPointer :: Array -> Int -> Ptr Word8 -> Int -> ST s ()

Copy to pointer.

Destination

Array

Source

Int

Source offset

Int

Count

empty :: Array

An empty immutable array.

equal :: Array -> Int -> Array -> Int -> Int -> Bool

Compare portions of two arrays for equality. No bounds checking is performed.

Array

First array

Int

Offset in the first array

Array

Second array

Int

Offset in the second array

Int

How many bytes to compare?

compare :: Array -> Int -> Array -> Int -> Int -> Ordering

Compare portions of two arrays. No bounds checking is performed.

Array

First array

Int

Offset in the first array

Array

Second array

Int

Offset in the second array

Int

How many bytes to compare?

run :: (forall s. ST s (MArray s)) -> Array

Run an action in the ST monad and return an immutable array of its result.

run2 :: (forall s. ST s (MArray s, a)) -> (Array, a)

Run an action in the ST monad and return an immutable array of its result paired with whatever else the action returns.

toList :: Array -> Int -> Int -> [Word8]

Convert an immutable array to a list.

unsafeFreeze :: MArray s -> ST s Array

Freeze a mutable array. Do not mutate the MArray afterwards!

unsafeIndex :: Array -> Int -> Word8

Unchecked read of an immutable array. May return garbage or crash on an out-of-bounds access.

new :: forall s. Int -> ST s (MArray s)

Create an uninitialized mutable array.

newPinned :: forall s. Int -> ST s (MArray s)

Create an uninitialized mutable pinned array.

unsafeWrite :: MArray s -> Int -> Word8 -> ST s ()

Unchecked write of a mutable array. May return garbage or crash on an out-of-bounds access.

tile :: MArray s -> Int -> ST s ()

Copyright
(c) 2009, 2010, 2011 Bryan O'Sullivan
Build record and source files

Community contribution. The service has not verified this documentation. The generator reported 2 diagnostics.

Target: Linux on x86-64. Some inferred types and resolved links are not available.

Generator: aihc-haddock-858b1951-web-1

Metadata snapshot: 0b0724abd14577f7a6c8172d62e3e1c0808feb114d4d379402e17f37e3c7801e

Open the dependency plan · Download the documentation model

Import a package

Enter a package name and an exact version from Hackage. The site contains imported versions only.