primitive-0.4.1: Wrappers for primitive operations

Portabilitynon-portable
MaintainerRoman Leshchinskiy <rl@cse.unsw.edu.au>
Safe HaskellSafe-Infered

Data.Primitive.Types

Description

Basic types and classes for primitive array operations

Synopsis

Documentation

class Prim a whereSource

Class of types supporting primitive array operations

Methods

sizeOf# :: a -> Int#Source

Size of values of type a. The argument is not used.

alignment# :: a -> Int#Source

Alignment of values of type a. The argument is not used.

indexByteArray# :: ByteArray# -> Int# -> aSource

Read a value from the array. The offset is in elements of type a rather than in bytes.

readByteArray# :: MutableByteArray# s -> Int# -> State# s -> (#State# s, a#)Source

Read a value from the mutable array. The offset is in elements of type a rather than in bytes.

writeByteArray# :: MutableByteArray# s -> Int# -> a -> State# s -> State# sSource

Write a value to the mutable array. The offset is in elements of type a rather than in bytes.

indexOffAddr# :: Addr# -> Int# -> aSource

Read a value from a memory position given by an address and an offset. The memory block the address refers to must be immutable. The offset is in elements of type a rather than in bytes.

readOffAddr# :: Addr# -> Int# -> State# s -> (#State# s, a#)Source

Read a value from a memory position given by an address and an offset. The offset is in elements of type a rather than in bytes.

writeOffAddr# :: Addr# -> Int# -> a -> State# s -> State# sSource

Write a value to a memory position given by an address and an offset. The offset is in elements of type a rather than in bytes.

data Addr Source

A machine address

Constructors

Addr Addr#