Bottom type
From Wikipedia, the free encyclopedia
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.
[edit] See also
[edit] External links
- Types and Programming Languages by Benjamin Pierce (MIT Press 2002) [1]