<div dir="ltr">This Wikipedia article is a good read for getting the concepts right: <a href="https://en.wikipedia.org/wiki/Algebraic_data_type">https://en.wikipedia.org/wiki/Algebraic_data_type</a></div><div class="gmail_extra"><br><div class="gmail_quote">On 29 September 2015 at 20:57, Karl Voelker <span dir="ltr"><<a href="mailto:karl@karlv.net" target="_blank">karl@karlv.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Tue, Sep 29, 2015, at 07:10 AM, <a href="mailto:jamb@hinojosa.com">jamb@hinojosa.com</a> wrote:<br>
> * "Tree" is the name of the new type.<br>
> * "Branch" and "Leaf" are the type constructors.<br>
> * What is "a" and "b"?<br>
<br>
</span>"Tree" is not quite the name of a type. It is the name of a type<br>
constructor - in other words, it is a "type-level function". This also<br>
explains "a" and "b" - they are the parameters to the type constructor<br>
(which means they are "type variables").<br>
<br>
To get a type, you have to apply the type constructor. So, for example,<br>
"Tree Char Int" is a type.<br>
<br>
"Branch" and "Leaf" are not type constructors - they are *data*<br>
constructors.<br>
<span class=""><br>
> * It seems to me that this type is kind of "recursively" defined but I<br>
> do not know exactly.<br>
<br>
</span>Yes. It's recursive because a value of type "Tree a b" can be built up<br>
from other values of type "Tree a b" (if you use the "Branch"<br>
constructor).<br>
<span class="HOEnZb"><font color="#888888"><br>
-Karl<br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div>Regards</div><div dir="ltr"><div><br></div><div>Sumit Sahrawat</div></div></div></div></div></div></div>
</div>