[Haskell-cafe] Is () a 0-length tuple?
deniz.a.m.dogan at gmail.com
Sun Nov 8 06:21:26 EST 2009
2009/11/7 Matthew Gruen <wikigracenotes at gmail.com>:
> Forgot to cc haskell-cafe. Trying again:
> ---------- Forwarded message ----------
> From: Matthew Gruen <wikigracenotes at gmail.com>
> Date: Sat, Nov 7, 2009 at 2:16 PM
> Subject: Re: [Haskell-cafe] Is () a 0-length tuple?
> To: Pasqualino Titto Assini <tittoassini at gmail.com>
> On Sat, Nov 7, 2009 at 2:00 PM, Pasqualino "Titto" Assini
> <tittoassini at gmail.com> wrote:
>> The syntax is similar, but what else is?
>> Isn't () the same thing? The only value of the unary type?
>> Pasqualino "Titto" Assini, Ph.D.
> to the 'object' type, whereas the undefined value belongs to the
> 'undefined' type. This is all a lot less useful when you realize that
> In JSON, arrays, objects, strings, and numbers can be any number of
> values. Booleans can be two values. Null can only be one value.
> Personally, I think a better mapping for () would be JSNull, since
> both have only one value in normal form. However, there is not
> necessarily any natural mapping between Haskell values and JSON
> values. The library tries to provide as many as possible, including
> (), which it happens to map to JSArray  instead of JSNull. As long
> as the library is internally consistent, though, it should be fine.
What point are you trying to make by distinguishing JSON from
system. "Null can be only one value." This doesn't make sense to me,
since as you say null is not a type, but a value.
More information about the Haskell-Cafe