HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulelinear-base-0.4.0Haskell2010

Data.Array.Mutable.Unlifted.Linear

This module provides an unlifted mutable array with a pure interface. Though the array itself is unlifted, it's elements are lifted types. This is made possible by using linear types to make sure array references are single threaded through reads and writes.

Accessing out-of-bounds indices causes undefined behaviour.

This module is meant to be imported qualified.

  • 1 type
  • 12 values
newtypenewtype Array# a
#

A mutable array holding as

valuealloc :: Int -> a -> (Array# a %1 -> Ur b) %1 -> Ur b
#

Allocate a mutable array of given size using a default value.

The size should be non-negative.

valueallocBeside :: Int -> a -> Array# b %1 -> (# Array# a, Array# b #)
#

Allocate a mutable array of given size using a default value, using another Array# as a uniqueness proof.

The size should be non-negative.

valuecopyInto :: Int -> Array# a %1 -> Array# a %1 -> (# Array# a, Array# a #)
#

Copy the first mutable array into the second mutable array, starting from the given index of the source array.

It copies fewer elements if the second array is smaller than the first. n should be within [0..size src).

 copyInto n src dest:
  dest[i] = src[n+i] for i < size dest, i < size src + n
valuetoList :: Array# a %1 -> Ur [a]
#

Return the array elements as a lazy list.