[Haskell-cafe] Is () a 0-length tuple?

Svein Ove Aas svein.ove at aas.no
Sun Nov 8 04:53:39 EST 2009

On Sun, Nov 8, 2009 at 9:52 AM, Ketil Malde <ketil at malde.org> wrote:
> Eugene Kirpichov <ekirpichov at gmail.com> writes:
>>> In JavaScript there is a "null" value, that is the only value of the null type.
>>> Isn't () the same thing?  The only value of the unary type?
>> No, () has two values: () and undefined (t.i., _|_).
How should I put it..?
undefined is bottom, but bottom is not undefined?

There are plenty of other constructions that are bottom. Infinite
loops, throws, errors.. common for all of them, of course, is that you
can't pattern-match on them or otherwise use them in pure code, and
they generally don't act like values.

So, can't we just say that () has a single value, namely ()? It'd make
this much simpler, and we won't have to deal with the Nihil monoid.


data Nihil

instance Monoid Nihil where
  mappend _ _ = undefined

Svein Ove Aas

More information about the Haskell-Cafe mailing list