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

Moduleprimitive-unlifted-2.1.0.0Haskell2010

Data.Primitive.Unlifted.SmallArray

GHC contains three general classes of value types:

  1. Unboxed types: values are machine values made up of fixed numbers of bytes. These include types like Int#, Char# and Addr#.

  2. Unlifted types: values are pointers, but strictly evaluated. These include types like MutVar# s a, Array# a, and MVar# s a.

  3. Lifted types: values are pointers, lazily evaluated.

Certain lifted types are really just thin wrappers around unboxed types (we can call these category 3a) or unlifted pointer types (we can call these category 3b) Category 3a includes Int, Char, and `Ptr a`, while category 3b includes IORef a, Data.Primitive.Array.Array a, and MVar a.

Types in category 3a can be stored efficiently in a Data.Primitive.PrimArray.PrimArray, removing and applying wrappers as required. This module provides the same facility for types in category 3b.

  • 4 types
  • 33 values

Types

4 declarations
datadata SmallUnliftedArray_ a (unlifted_a :: UnliftedType)
#

A SmallUnliftedArray_ a unlifted_a represents an array of values of a lifted type a that wrap values of an unlifted type unlifted_a. It is expected that unlifted_a ~ Unlifted a, but imposing that constraint here would force the type roles to nominal, which is often undesirable when arrays are used as components of larger datatypes.

Constructors

Instances8IsList, Eq, Show, Semigroup, Monoid, PrimUnlifted, …
datadata SmallMutableUnliftedArray_ s a (unlifted_a :: UnliftedType)
#
Instances3Eq, PrimUnlifted, Unlifted

Operations

22 declarations

Creates a new MutableUnliftedArray. This function is unsafe because it initializes all elements of the array as pointers to the empty array. Attempting to read one of these elements before writing to it is in effect an unsafe coercion from UnliftedArray a to the element type.

List Conversion

3 declarations

Folding

5 declarations

Traversals

2 declarations

Mapping

1 declaration