I don\'t understand the role played by bottom (⊥
or _|_
) in Haskell function definitions.
The definition of zip for example describes it as \"r
⊥ comes out of mathematical order theory. A partially ordered collection has a bottom element, denoted ⊥, if that element precedes every other element. How does this get into Haskell documentation? At some point, computer scientists realized that it would be useful to think about what a computer program, in whatever language, "means". One approach to that is called denotational semantics. In denotational semantics, each term in the programming language is assigned a "denotation", or meaning, in some universe of mathematical meanings. It would be wonderful to be able to say, for instance, that
meaningInteger :: Integer -> mathematical integer
meaningList :: [a] -> possibly-infinite sequence of elements of type a
Unfortunately, this doesn't quite work out in Haskell, because, for instance, I can write
oops :: Integer
oops = oops
This gives me a term of type Integer
, but there's no sensible way to assign it a meaning as a mathematical integer. More interestingly, I could write things like
undefined
undefined : undefined
3 : undefined
[undefined]
let foo = undefined : 3 : undefined : foo
These all (can) have the same type, but have various different levels of undefinedness. So we need to add to our collection of meanings various sorts of undefined things. It's possible, however, to impose a partial order on them based on how defined they are! For example, 3 : 4 : []
is more defined than 3 : 4 : undefined
, and is also more defined than 3 : undefined : 4
, but the latter two are not comparable. The bottom element of each type, its very least defined element, is called ⊥.