text-utf8-1.2.3.0: An efficient packed UTF-8 backed Unicode text type.

Copyright(c) 2009 2010 2011 Bryan O'Sullivan
LicenseBSD-style
Maintainerbos@serpentine.com
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Data.Text.Array

Contents

Description

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.

Synopsis

Types

data Array Source #

Immutable array type.

The Array constructor is exposed since text-1.1.1.3

Constructors

Array 

Fields

data MArray s Source #

Mutable array type, for use in the ST monad.

The MArray constructor is exposed since text-1.1.1.3

Constructors

MArray 

Fields

Functions

copyM Source #

Arguments

:: MArray s

Destination

-> Int

Destination offset

-> MArray s

Source

-> Int

Source offset

-> Int

Count

-> ST s () 

Copy some elements of a mutable array.

copyI Source #

Arguments

:: MArray s

Destination

-> Int

Destination offset

-> Array

Source

-> Int

Source offset

-> Int

First offset in destination not to copy (i.e. not length)

-> ST s () 

Copy some elements of an immutable array.

copyToPtr Source #

Arguments

:: Ptr Word8

Destination

-> Int

Destination offset

-> Array

Source

-> Int

Source offset

-> Int

First offset in destination not to copy (i.e. not length)

-> IO () 

Copy some elements of an immutable array to a pointer

copyFromPtr Source #

Arguments

:: MArray s

Destination

-> Int

Destination offset

-> Ptr Word8

Source

-> Int

Source offset

-> Int

Count

-> ST s () 

empty :: Array Source #

An empty immutable array.

equal Source #

Arguments

:: Array

First

-> Int

Offset into first

-> Array

Second

-> Int

Offset into second

-> Int

Count

-> Bool 

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

cmp Source #

Arguments

:: Array

First

-> Int

Offset into first

-> Array

Second

-> Int

Offset into second

-> Int

Count

-> Ordering 

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

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

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) Source #

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] Source #

Convert an immutable array to a list.

unsafeFreeze :: MArray s -> ST s Array Source #

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

unsafeIndex :: Array -> Int -> Word8 Source #

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

unsafeIndex32 :: Array -> Int -> Word32 Source #

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

unsafeIndex64 :: Array -> Int -> Word64 Source #

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) Source #

Create an uninitialized mutable array.

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

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

unsafeWrite32 :: MArray s -> Int -> Word32 -> ST s () Source #

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

unsafeWrite64 :: MArray s -> Int -> Word64 -> ST s () Source #

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