Difference between revisions of "Bottom"

From HaskellWiki
Jump to navigation Jump to search
(bold keyword)
(Added remark that _|_ is a member of any type)
Line 2: Line 2:
   
 
The mathematical symbol for bottom is '&perp;'. That's Unicode character 22A5 hex = 8869 decimal. Also available in HTML as '&amp;perp;' and in LaTeX as '\bot' (within math mode). In plain ASCII, it's often written as the extremely ugly character sequence '<code>_|_</code>'.
 
The mathematical symbol for bottom is '&perp;'. That's Unicode character 22A5 hex = 8869 decimal. Also available in HTML as '&amp;perp;' and in LaTeX as '\bot' (within math mode). In plain ASCII, it's often written as the extremely ugly character sequence '<code>_|_</code>'.
  +
  +
Bottom is a member of any type, even the trivial type () or the equivalent simple type:
  +
  +
<haskell>
  +
data Unary = Unary
  +
</haskell>
  +
  +
If it were not, the compiler could solve the [http://en.wikipedia.org/wiki/Halting_problem halting problem] and statically determine whether any computation terminated.
  +
  +
Bottom can be expressed in Haskell thus:
  +
  +
<haskell>
  +
bottom = bottom
  +
</haskell>
  +
  +
or
  +
  +
<haskell>
  +
bottom = error "Non-terminating computation!"
  +
</haskell>
   
 
[[Category:Glossary]]
 
[[Category:Glossary]]

Revision as of 21:37, 4 January 2008

The term bottom refers to a computation which never completes successfully. That includes a computation that fails due to some kind of error, and a computation that just goes into an infinite loop (without returning any data).

The mathematical symbol for bottom is '⊥'. That's Unicode character 22A5 hex = 8869 decimal. Also available in HTML as '&perp;' and in LaTeX as '\bot' (within math mode). In plain ASCII, it's often written as the extremely ugly character sequence '_|_'.

Bottom is a member of any type, even the trivial type () or the equivalent simple type:

data Unary = Unary

If it were not, the compiler could solve the halting problem and statically determine whether any computation terminated.

Bottom can be expressed in Haskell thus:

bottom = bottom

or

bottom = error "Non-terminating computation!"