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

Ivan Lazar Miljenovic ivan.miljenovic at gmail.com
Thu Mar 3 08:21:26 CET 2011

On 3 March 2011 17:59, Karthick Gururaj <karthick.gururaj at gmail.com> wrote:
> On Thu, Mar 3, 2011 at 11:48 AM, Chris Smith <cdsmith at gmail.com> wrote:
>> On Thu, 2011-03-03 at 11:39 +0530, Karthick Gururaj wrote:
>>> What is the "()" type? Does it refer to a tuple? How can tuple be
>>> ordered, let alone be enum'd? I tried:
>> The () type is pronounced "unit".  It is a type with only 1 value, also
>> called () and pronounced "unit".  Since it only has one possible value,
>> it conveys no information at all, and is sometimes used in situations
>> analogous to C's 'void' keyword.
>> Okay, actually that was a little bit of a lie; () has two "values": ()
>> and bottom.  Bottom is the "value" that corresponds to the program
>> hanging in an infinite loop or dying with an error message.  But if you
>> have an actual, honest-to-goodness value that's not bottom, it has to be
>> ().
> Thanks - is this the same "unit" that accompanies IO in "IO ()" ? In
> any case, my question is answered since it is not a tuple.


Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com

More information about the Haskell-Cafe mailing list