Jump to content

Bottom type

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by 82.67.232.89 (talk) at 19:21, 11 September 2007 (iwk lk). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

The bottom type in type theory is a type that has no values. It is commonly abbreviated as bot, by the up tack symbol (⊥) or by its ASCII approximation _|_. The bottom type is also called the zero or empty type. It contrasts with the top type, which spans all possible values in a system, and a unit type, which has only one value.

The bottom type is frequently used for the following purposes:

  • To signal that a function or computation diverges; in other words, does not return a result to the caller. (This does not necessarily mean that the program fails to terminate; a subroutine may terminate without returning to its caller, or exit via some other means such as a continuation.)
  • As an indication of error; this usage primarily occurs in theoretical languages where distinguishing between errors is unimportant. Production programming languages typically use exception handling instead.

In Haskell, the keyword undefined represents a computation for which the result has the bottom type. Attempting to evaluate the computation undefined at runtime aborts the program.

See also

  • Types and Programming Languages by Benjamin Pierce (MIT Press 2002) [1]