Go to the first, previous, next, last section, table of contents.
This section defines all the types which are primitive in Glasgow
Haskell, and the operations provided for them.
A primitive type is one which cannot be defined in Haskell, and which
is therefore built into the language and compiler. Primitive types
are always unboxed; that is, a value of primitive type cannot be
bottom.
Primitive values are often represented by a simple bit-pattern, such
as `Int#', `Float#', `Double#'. But this is not necessarily the case:
a primitive value might be represented by a pointer to a
heap-allocated object. Examples include `Array#', the type of
primitive arrays. You might think this odd: doesn't being
heap-allocated mean that it has a box? No, it does not. A primitive
array is heap-allocated because it is too big a value to fit in a
register, and would be too expensive to copy around; in a sense, it is
accidental that it is represented by a pointer. If a pointer
represents a primitive value, then it really does point to that value:
no unevaluated thunks, no indirections...nothing can be at the other
end of the pointer than the primitive value.
This section also describes a few non-primitive types, which are needed
to express the result types of some primitive operations.
Go to the first, previous, next, last section, table of contents.