[Haskell-cafe] Learn You a Haskell for Great Good - a few doubts

wren ng thornton wren at freegeek.org
Fri Mar 4 07:14:36 CET 2011

On 3/3/11 2:58 AM, Antti-Juhani Kaijanaho wrote:
> On Thu, Mar 03, 2011 at 12:29:44PM +0530, Karthick Gururaj wrote:
>> Thanks - is this the same "unit" that accompanies IO in "IO ()" ? In
>> any case, my question is answered since it is not a tuple.
> It can be viewed as the trivial 0-tuple.

Except that this is problematic since Haskell doesn't have 1-tuples 
(which would be distinct from plain values in that they have an extra 

In an idealized world, yes, unit can be thought of as the nullary 
product which serves as left- and right-identity for the product 
bifunctor. Unfortunately, Haskell's tuples aren't quite products.[1]

[1] To be fair, a lot of thought went into choosing for them to be the 
way they are. The way they are generally matches the semantics we 
desire, but this is one of the places where they don't. The only way to 
"fix" this is to have two different product types, which is problematic 
for the obvious reasons.

Live well,

More information about the Haskell-Cafe mailing list