HORIZON HASKELLDocslts/ghc-10.0.x77a86622026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 77a8662 · 2026-10-31

Moduleprimitive-addr-0.1.0.3Haskell2010

Data.Primitive.Addr

Primitive operations on machine addresses.

Contents
  1. Types
  2. Address arithmetic
  3. Element access
  4. Block operations
  5. Conversion
Synopsis

Types

datadata Addr

A machine address

Constructors

Instances3Eq, Ord, Show
  • Eq AddrDefined in primitive-addr-0.1.0.3 · Data.Primitive.Addr
  • Ord AddrDefined in primitive-addr-0.1.0.3 · Data.Primitive.Addr
  • Show AddrDefined in primitive-addr-0.1.0.3 · Data.Primitive.Addr

Address arithmetic

Element access

valueindexOffAddr :: Prim a => Addr -> Int -> a

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.

valuereadOffAddr :: (Prim a, PrimMonad m) => Addr -> Int -> m a

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.

valuewriteOffAddr :: (Prim a, PrimMonad m) => Addr -> Int -> a -> m ()

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.

Block operations

valuecopyAddr
  1. :: PrimMonad m
  2. => Addr

    destination address

  3. -> Addr

    source address

  4. -> Int

    number of bytes

  5. -> m ()

Copy the given number of bytes from the second Addr to the first. The areas may not overlap.

valuemoveAddr
  1. :: PrimMonad m
  2. => Addr

    destination address

  3. -> Addr

    source address

  4. -> Int

    number of bytes

  5. -> m ()

Copy the given number of bytes from the second Addr to the first. The areas may overlap.

valuesetAddr :: (Prim a, PrimMonad m) => Addr -> Int -> a -> m ()

Fill a memory block of with the given value. The length is in elements of type a rather than in bytes.

Conversion