<div dir="auto">The nullary constructor, as far as the term has meaning in most languages, is () a.k.a. unit. It takes no arguments, and returns a valid data type.<div dir="auto"><br></div><div dir="auto">There is, however, an even less populated type: Void has no legal values at all! If nullary is arity 0, this is roughly arity i. It is still useful as a type-level encoding of "impossible outcome" in parametric code.</div></div><br><div class="gmail_quote"><div dir="ltr">On Sat, Aug 18, 2018, 3:09 AM trent shipley <<a href="mailto:trent.shipley@gmail.com">trent.shipley@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">OK. That makes total sense. And a little experimentation with GHCi or reading the prelude would have prevented my spamming the list.<div><br></div><div>What about the tacked on question about nullity in "core" Haskell?</div></div><br><div class="gmail_quote"><div dir="ltr">On Sat, Aug 18, 2018 at 2:37 AM Francesco Ariis <<a href="mailto:fa-ml@ariis.it" target="_blank" rel="noreferrer">fa-ml@ariis.it</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello Trent,<br>
<br>
On Sat, Aug 18, 2018 at 02:13:25AM -0700, trent shipley wrote:<br>
> Why does Haskell so often seem to treat [] as a general null.<br>
> <br>
> For example I know 0 : 1 : [] gives [0, 1].<br>
> <br>
> But shouldn't it produce a type fault in a consistent world?<br>
> <br>
> Int:Int:List isn't properly a list. It mixes types.<br>
<br>
`:` is not syntactic sugar, but a data constructor and behaves like one!<br>
<br>
λ> :type (:)<br>
(:) :: a -> [a] -> [a]<br>
<br>
"Give me an `a` and a list of `a`, I will return a list."<br>
<br>
The `empty list` ([]) is polymorphic:<br>
<br>
λ> :t []<br>
[] :: [a]<br>
<br>
(it could be an empty list of strings, of ints, of dromedaries),<br>
so `3:[]` is well typed.<br>
<br>
Note that `3:[]:4` will not type-check and that to build a list, you<br>
*have* to start with a `[]`.<br>
<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank" rel="noreferrer">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</blockquote></div>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank" rel="noreferrer">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</blockquote></div>