[Haskell-beginners] Why is there no notion of a one-tuple (e.g., a '([])' as opposed to a '[]') in Haskell?

ajb at spamcop.net ajb at spamcop.net
Wed Sep 24 21:27:37 EDT 2008

G'day all.

Quoting "Benjamin L.Russell" <DekuDekuplex at Yahoo.com>:

>> Haskell doesn't have a notion of a one-element tuple.
> Why not?

As noted by others, there's no syntactic space for them.

Perhaps more crucially, it's hard to see where such a thing would
be useful.  The 2-tuple (i.e. pair) is a categorical product, and can
be used to carry around two things where you would normally only
have space for one.  The 0-tuple (i.e. void) is a categorical terminal
object, and can be used to fill in space in a parametric data structure
where no annotation is actually needed.

One reason why they're provided in the Prelude is so that standard
functions can do operations on them.  It's hard to see where a standard
function would use a generic 1-tuple.

Generally speaking, if you need a type-checked 1-tuple, you almost
certainly don't want a generic one.

Andrew Bromage

More information about the Beginners mailing list