[Haskell-beginners] Would you shed light on "undefined values" please?

Costello, Roger L. costello at mitre.org
Fri Jun 24 00:35:19 CEST 2011

Hi Folks,

In this book [1] the author defines the term "bottom":

   In order that we can say that, without exception, every
   syntactically well-formed expression denotes a value,
   it is convenient to introduce a special symbol (upside
   down T), pronounced 'bottom', to stand for the undefined
   value of a particular type. In particular, the value of
   infinity is the undefined value (bottom) of type Integer,
   and 1/0 is the undefined value (bottom) of type Float.
   Hence we can assert that 1/0 = bottom.

He defines infinity as this:

    infinity :: Integer
    infinity = infinity + 1

The author says this when discussing the Bool datatype:

    It follows that there are not two but three Boolean
    values, namely False, True, and bottom. In fact, every
    datatype declaration introduces an extra anonymous
    value, the undefined value of the datatype.

What is the undefined value (bottom) of type Bool?

What is the undefined value (bottom) of type String?

If I create my own datatype:

data MyBool = F | T

What is the undefined value (bottom) of type MyBool?

I am not clear why "bottom" is an important concept. Would you explain please?


[1] Introduction to Functional Programming using Haskell by Richard Bird

More information about the Beginners mailing list