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

Matthew Gruen wikigracenotes at gmail.com
Sun Nov 8 16:10:12 EST 2009

On Sun, Nov 8, 2009 at 6:21 AM, Deniz Dogan <deniz.a.m.dogan at gmail.com>
> What point are you trying to make by distinguishing JSON from
> JavaScript? JSON is a subset of JavaScript, they share the same type
> 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.
> --
> Deniz Dogan

It seems I underestimated the typedness of null in JavaScript :) I checked
the ECMAScript specification, and it does refer to a "null type".. so titto
was right.[1] My opinion is that JSON's 'type system' should be analyzed
orthogonal to JavaScript's regardless. If JSON is a subset of JavaScript, it
is primarily a syntactic one. When I said "Null can be only one value",
implying that null is a type, I was referring to JSON's null, not
JavaScript's null. In JSON, null *is* definitely a unit type. When
considering mappings between Haskell and JSON in the case of (), we should
see that () is a unit type in Haskell, null is a unit type in JSON
(regardless of its role in JavaScript), and maybe try to associate them.


[1] I was misled by the fact that typeof null = 'object'. The logic behind
this, I think, is that null is meant to be bound to a variable that would
otherwise be a reference to an actual object value. Many have criticized
this result, e.g. Douglas Crockford (
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20091108/a10bb2af/attachment.html

More information about the Haskell-Cafe mailing list