HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduleprimitive-addr-0.1.0.3Haskell2010

Data.Primitive.Addr

Primitive operations on machine addresses.

  • 1 type
  • 12 values

Types

1 declaration
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

4 declarations
valueminusAddr :: Addr -> Addr -> Int
#

Distance in bytes between two addresses. The result is only valid if the difference fits in an Int.

Element access

3 declarations
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

4 declarations
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

1 declaration